1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

'length' function now measures string length in codepoints, not bytes.

This commit is contained in:
Stephen Dolan
2013-05-15 00:37:38 +01:00
parent c496a924ce
commit e83e51eb56
9 changed files with 29 additions and 17 deletions

View File

@@ -93,7 +93,7 @@ struct lexer_param;
(\\[^u(]|\\u[a-zA-Z0-9]{0,4})+ {
/* pass escapes to the json parser */
jv escapes = jv_string_fmt("\"%.*s\"", yyleng, yytext);
yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length(jv_copy(escapes)));
yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes)));
jv_free(escapes);
return QQSTRING_TEXT;
}