xml 中如果包含部分 ascii 控制字符(小数字)则 chrome会报告如下类型错我:
This page contains the following errors:
error on line @H_404_14@20 at column @H_404_14@89: Input is not proper UTF-@H_404_14@8,indicate encoding !
Bytes: @H_404_14@0x08 @H_404_14@0xE8 @H_404_14@0xBA @H_404_14@0xB2
Below is a rendering of the page up to the first error.
解决办法:replace 这些字符
xxx.replace(/\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\u0008|\u0009|\u000a|\u000b|\u000c|\u000d|\u000e|\u000f|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001a|\u001b|\u001c|\u001d|\u001e|\u001f/g,"")
原因:XML 规范不支持如下字符
#x0 - #x8 (ASCII @H_404_14@0 - @H_404_14@8)
#xB - #xC (ASCII @H_404_14@11 - @H_404_14@12)
#xE - #x1F (ASCII @H_404_14@14 - @H_404_14@31)