URI malformed的坑 求解救
本来是decodeURIComponent(escape(…))就能解决一切问题的。但是到了Node.js上貌似会变得很复杂
之前就找到遇到同样问题的人了,不过在Github上讨论的方法貌似用在我的项目上是不行的。用到了 querystring.decode(querystring.escape)
,虽然没有报错,但是却是乱码。
URIError: URI malformed
at decodeURIComponent (native)
at charenc_UTF8_bytesToString (E:\SourceBox\AuthSite\models\eLib.js:175:12)
at Object.dec (E:\SourceBox\AuthSite\models\eLib.js:152:9)
at E:\SourceBox\AuthSite\routes\index.js:7:33
at callbacks (E:\SourceBox\AuthSite\node_modules\express\lib\router\index.js:161:37)
at param (E:\SourceBox\AuthSite\node_modules\express\lib\router\index.js:135:11)
at pass (E:\SourceBox\AuthSite\node_modules\express\lib\router\index.js:142:5)
at Router._dispatch (E:\SourceBox\AuthSite\node_modules\express\lib\router\index.js:170:5)
at Object.router (E:\SourceBox\AuthSite\node_modules\express\lib\router\index.js:33:10)
at next (E:\SourceBox\AuthSite\node_modules\express\node_modules\connect\lib\proto.js:199:15)
实在不知道怎么去解决。 谢谢大家了~