1

I am taking a string which is in THAI language. If I use IDE( e.g. eclipse) , I can able to print the string in the console. But if I convert the project into executable jar or tried to run the class from command prompt, it is printing different set of characters.

My code is below :

import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Locale;

public class Sample {

    public static void main(String[]  aaaa){

         String str = "อับดุลเลาะ";
         System.out.println(str);
      }
}

When I execute the above code in eclipse , it displays correct value i.e., อับดุลเลาะ. But if i run the code from command prompt, it displays à??à?±à??à??à??à?¥à??à?¥à?²à?°.

Need help to solve the problem.

IB1990
  • 27
  • 3
  • 1
    My guess would be that command prompt uses font that doesn't support Thai characters. I probably depends on the command prompt itself, it might be possible to import extra fonts. – Amongalen Dec 03 '19 at 10:38
  • 1
    When you say "command prompt," do you mean the Windows `cmd.exe` program? Or were you using the term generally? Answers are likely to be specific to which command prompt you're using... – T.J. Crowder Dec 03 '19 at 10:39
  • 1
    At least related: https://stackoverflow.com/questions/7112733/unable-to-process-special-character-on-command-prompt – T.J. Crowder Dec 03 '19 at 10:40
  • 1
    When I execute the code from command prompt / cmd.exe, the different set of characters are displaying. Actually my goal is to take some records from a CSV file by CSVReader, and push into the database table. While trying to read, it works fine when using eclipse. But when we build the code into executable jar, it is importing ???? into the table. – IB1990 Dec 03 '19 at 10:43

0 Answers0