RE: [EWD:6447] UTF-8 to Shift_JIS conversion issue in mg_web (Windows / v2.8.43g)

3 views
Skip to first unread message

chris....@gmail.com

unread,
Mar 10, 2026, 5:36:31 AM (4 days ago) Mar 10
to enterprise-web-de...@googlegroups.com

I don’t believe mg_web is doing this character conversion.  In fact, mg_web simply passes the incoming data stream from the web server to IRIS, and the application can process it in accordance with its own rules.

 

So, if the browser sends its request payload as UTF-8, then I would expect that stream to arrive, unprocessed, in the IRIS code.  The only exception to this would be if the web server applies any content filter/transformation to the incoming payload – that transformation would take place before the web server passes the payload to mg_web.

 

If you can supply us with a detailed example of what’s happening we’ll take a look.

 

Regards,

 

Chris.

 

From: enterprise-web-de...@googlegroups.com <enterprise-web-de...@googlegroups.com> On Behalf Of Takayoshi Tsuchiya
Sent: 02 March 2026 12:32
To: Enterprise Web Developer Community <enterprise-web-de...@googlegroups.com>
Subject: [EWD:6447] UTF-8 to Shift_JIS conversion issue in mg_web (Windows / v2.8.43g)

 

Hello Chris and community members,

I am using mg_web (version v2.8.43g on Windows) to develop a web application with InterSystems IRIS.
The framework is very useful and works well, but I have encountered an issue regarding Japanese UTF‑8 handling.

Even though the browser sends request parameters in UTF‑8, mg_web internally converts the incoming data into Shift_JIS (CP932) before passing it to IRIS. As a result, Japanese characters become corrupted unless I manually re-convert them on the IRIS side.

From reviewing the source code, it appears that mg_web uses Windows API functions such as:

    MultiByteToWideChar(CP_ACP, ...)
    WideCharToMultiByte(CP_ACP, ...)

On Japanese Windows, CP_ACP corresponds to CP932 (Shift_JIS), so UTF‑8 input is always misinterpreted and re-encoded incorrectly. This behavior seems to be the root cause.

In Europe or English-speaking environments, this issue may not be visible because ASCII characters are unaffected, but for Japanese (multi-byte UTF‑8), the conversion breaks the data.

My questions are:

1. Is there an existing option or configuration to force mg_web to treat all input/output as UTF‑8?
2. If not, would it be possible to modify mg_web so that it uses CP_UTF8 instead of CP_ACP on Windows?
3. Alternatively, is there a recommended patch or approach to make mg_web fully UTF‑8 compatible?

I would be happy to test any proposed changes or provide additional information.

Thank you very much for your support and for maintaining mg_web.

Best regards,
Takayoshi Tsuchiya
Japan

--
You received this message because you are subscribed to the Google Groups "Enterprise Web Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enterprise-web-develope...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/enterprise-web-developer-community/364e2cbc-4a1c-4781-9ef2-cf753be546efn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages