我正在通过SAX解析器运行一些XML,并注意到解析器无法正常运行某些字符作为数据内容。 XML应该是UTF-8编码,SAX解析器设置为处理该编码。
缩小有问题的字符串并在十六进制编辑器中查看XML文件我可以看到例如2C10导致问题,如果我将其改为C2A2(维基百科上给出的示例字符),那么SAX解析器可以工作。那么2C10不是有效的UTF8字符吗?
答案 0 :(得分:1)
UTF-8 page on Wikipedia意味着2C10将被解释为,
,后跟控制代码DLE
(数据链接转义,显然)。在XML中出现在CDATA块之外的控制字符似乎不合适!
答案 1 :(得分:0)
U + 2C10是GLAGOLITIC CAPITAL LETTER NASHI
。这是它的属性:
U+2C10 ‹Ⱀ› \N{GLAGOLITIC CAPITAL LETTER NASHI}
\w \pL \p{LC} \p{L_} \p{L&} \p{Lu}
All Any Alnum Alpha Alphabetic Assigned InGlagolitic Glagolitic
Is_Glagolitic Cased Cased_Letter LC Changes_When_Casefolded
CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased
CWL Changes_When_NFKC_Casefolded CWKCF Lu L Glag Gr_Base
Grapheme_Base Graph GrBase ID_Continue IDC ID_Start IDS
Letter L_ Uppercase_Letter Print Upper Uppercase Word
XID_Continue XIDC XID_Start XIDS X_POSIX_Alnum X_POSIX_Alpha
X_POSIX_Graph X_POSIX_Print X_POSIX_Upper X_POSIX_Word
Age=4.1 Bidi_Class=L Bidi_Class=Left_To_Right BC=L
Block=Glagolitic Canonical_Combining_Class=0
Canonical_Combining_Class=Not_Reordered CCC=NR
Canonical_Combining_Class=NR General_Category=Cased_Letter
Decomposition_Type=None DT=None East_Asian_Width=Neutral
GC=LC General_Category=L General_Category=Letter
General_Category=L_ General_Category=LC GC=L
General_Category=Lu General_Category=Uppercase_Letter GC=Lu
Script=Glagolitic Grapheme_Cluster_Break=Other GCB=XX
Grapheme_Cluster_Break=XX Hangul_Syllable_Type=NA
Hangul_Syllable_Type=Not_Applicable HST=NA
Joining_Group=No_Joining_Group JG=NoJoiningGroup
Joining_Type=Non_Joining JT=U Joining_Type=U Line_Break=AL
Line_Break=Alphabetic LB=AL Numeric_Type=None NT=None
Numeric_Value=NaN NV=NaN Present_In=4.1 IN=4.1
Present_In=5.0 IN=5.0 Present_In=5.1 IN=5.1 Present_In=5.2
IN=5.2 Present_In=6.0 IN=6.0 Script=Glag SC=Glag
Sentence_Break=UP Sentence_Break=Upper SB=UP
Word_Break=ALetter WB=LE Word_Break=LE _X_Begin