Skip to content

Commit 71812e5

Browse files
authored
Update tutorial04_answer.md: 辨法 -> 办法
1 parent ca12f4c commit 71812e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tutorial04_answer/tutorial04_answer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static const char* lept_parse_hex4(const char* p, unsigned* u) {
3535
}
3636
~~~
3737

38-
但这个实现会错误地接受 `"\u 123"` 这种不合法的 JSON,因为 `strtol()` 会跳过开始的空白。要解决的话,还需要检测第一个字符是否 `[0-9A-Fa-f]`,或者 `!isspace(*p)`。但为了 `strtol()` 做多余的检测,而且自行实现也很简单,我个人会选择首个方案。(前两个单元用 `strtod()` 就没辨法,因为它的实现要复杂得多。)
38+
但这个实现会错误地接受 `"\u 123"` 这种不合法的 JSON,因为 `strtol()` 会跳过开始的空白。要解决的话,还需要检测第一个字符是否 `[0-9A-Fa-f]`,或者 `!isspace(*p)`。但为了 `strtol()` 做多余的检测,而且自行实现也很简单,我个人会选择首个方案。(前两个单元用 `strtod()` 就没办法,因为它的实现要复杂得多。)
3939

4040
## 2. 实现 `lept_encode_utf8()`
4141

0 commit comments

Comments
 (0)