I am working on a website that, before I ported all of the routing to a Node/Express/EJS app, had all of the character encoding as Shift_JIS (a Japanese encoding not natively supported by node). Now, all pages are rendered as UTF-8; there are some services that run on the website that are reliant on the Shift_JIS encoding.
I have tried making custom middleware to force the header for Vary: Accept-Encoding (although I am not sure I did this right), to change the encoding html to Shift_JIS (this works for other headers and other HTML attributes such as Doctype) but everything continually renders as UTF-8.
I have seen some of the shivs that add functionality for alternative encodings in node, but I am not sure how I could apply them to my Express app.
I would provide a minimal working example, but I think the problem is self-explanatory and I cannot provide any working code from the project.
In review: I have a site that -needs- to be rendered in Shift_JIS encoding, NOT UTF-8. I have tried some solutions and hit a brick wall.
Any help would be incredibly appreciated. This is really blocking development, and I have experience in a lot of areas but foreign encoding is not one of them.
You may be able to create your own middleware based on https://www.npmjs.com/package/iconv-js converts all your output to Shift-JIS or detects something in the request and only converts responses to certain requests to Shift-JIS.
See https://coderwall.com/p/miq0iw/node-express-middleware-to-post-process-requests for an example of creating your own post processing middleware.