原以为 encodeURIComponent() 是一个安全的不会抛异常的方法,但是最近日志里面捕获到一个 URIError,来自querystring.js
google了一下,从这段代码的实现,可以复现此异常:
> encodeURIComponent(String.fromCharCode(0xDFFF))
URIError: URI malformed
at repl:1:2
at REPLServer.eval (repl.js:80:21)
at Interface.<anonymous> (repl.js:182:12)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream.<anonymous> (readline.js:82:12)
at ReadStream.emit (events.js:88:20)
at ReadStream._emitKey (tty.js:327:10)
现在还没解决的疑问,是这种数据是如何传递过去的。