tiansh / us-danmaku

Firefox 扩展版本见 https://github.com/tiansh/ass-danmaku ;在线转换见 https://tiansh.github.io/ass-danmaku-online/ ;【用户脚本已停止维护】用户脚本 以ass格式下载 AcFun 和 bilibili 的弹幕
210 stars 48 forks source link

parse Xml with invalid characters #21

Closed myfreeer closed 7 years ago

myfreeer commented 7 years ago

example:<d p="1341.9599609375,1,25,16777215,1478103506,0,d41c3583,2625752953"> 繰り返し</d> example xml: http://comment.bilibili.com/2054635.xml

tiansh commented 7 years ago

also, notice that old version of javascript, and most string operations do NOT support unicode.

(notice, you should write \uXXXX or \u{XXXXXX} but not \uXXXXXX.

which meanse:

 '\uDBFF\uDFFF' === '\u{10ffff}' // true
'\u{10ffff}'.match(/[\u{10ffff}]/) // null
'\u{10ffff}'.match(/[\u{10ffff}]/u) // ["\uDBFF\uDFFF"]
'\u10ffff'.match(/[\u10ffff]/g) // ["\u10FF", "f", "f"]

u flag for regexp need chrome50 and firefox46, which is newer than many chinese chrome-based browsers and newer than firefox esr. personally, i dont want use this in this script at this time.