How to do character-set conversion from ASCII to Shift_JIS

0
Hi    Is any java action ore market place module for character-set conversion from ASCII to Shift_JIS.   Thanks , Harika
asked
1 answers
0

Hi Harika,

To my knowledge, I am not sure, if there's any Java action present,

But of course we can create our own Java action using package:

java.nio.charset

for the same,

Dummy code:

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class ConvertASCIItoShiftJIS {
    public static String convert(String asciiText) {
        try {
            byte[] asciiBytes = asciiText.getBytes(StandardCharsets.US_ASCII);
            return new String(asciiBytes, Charset.forName("Shift_JIS"));
        } catch (Exception e) {
            return "Error in conversion: " + e.getMessage();
        }
    }
}

 

Note: As of now, there isn't a direct Mendix Marketplace module for ASCII to Shift_JIS conversion, but you can check the "Text Handling" or "String Utils" modules, which might have encoding utilities.

 

Hope it helps!

answered