1
votes

When we started implementing Mulesoft as a pilot in our company, we noticed that mulesoft would inherit the system codepage (windows-1252) at seemingly random moments. Despite setting the Anypoint studio (7.2.0) preference, and runtime (4.2.1 EE) defaults to UTF-8. Therefore the outgoing connectors (and default http connectors) would send their http requests in this encoding. Any API we write then gave the following error:

Message               : HTTP PUT on resource 'https://mocksvc-proxy.anypoint.mulesoft.com:443/exchange/*********/1.0.2/subscription' failed: media type application/json; charset=windows-1252 not supported (415).

We found that the solution for this was to set the encoding on a message transform right before the connector to force it to UTF-8 like this:

    <ee:transform doc:name="Transform Message" doc:id="-redacted-">
        <ee:message>
            <ee:set-payload><![CDATA[%dw 2.0
             output application/json encoding="UTF-8"
              ---
           {
           "applicatie": "-redacted-",
           "clientid": vars."-redacted-" as Number
            }]]></ee:set-payload>
        </ee:message>
    </ee:transform>

However since anypoint studio 7.2.1 this fix no longer works. I can't find anything we've changed, and all settings are still set to UTF-8.

Project setting set to UTF-8 image

Does anyone know of a method we can try to force the encoding, or get the api's we build to accept windows-1252? (which would be acceptable but not preferable, if at all possible)

Or do you think that this is a bug we need to report to mulesoft?

This problem is occuring on Mule Standalone EE Version: 4.1.2 Build: 41de9970 on Windows server 2016 Datacenter. Anypoint studio embedded Mule 4.1.2 on Windows 7.

1

1 Answers

1
votes

The code and sollutions tried above are correct, it was a bug in mule runtime 4.2.1(.2).

It is fixed in version 4.1.3(.2), if you encounter this problem, update to fix it.