Home > Software engineering >  Nodejs convert windows-1252 to utf-8 in express
Nodejs convert windows-1252 to utf-8 in express

Time:07-28

My Express server cannot handle requests with the windows-1252 character set because Express router puts the path in the decodeURIComponent() method and throws an error. My idea now is to call the decodeURIComponent() method myself in a middleware, catch the error and then try to work with a replacement. I have already found a corresponding table in section ASCII Encoding Reference in https://www.w3schools.com/tags/ref_urlencode.ASP

My first question is, is this possible? My second question is, is there a package for this? I have to rely on require statements, I can't include packages with import.

An example path /pictures/M

  • Related