1

I need to allow internationals words in our string.

For example:

public class Java
{
    public static void main (String[] args) throws Exception
    {
        String a="ğğğğ";
        System.out.println(a);
    }
}

The expected output is:

ğğğğ

but I get:

????

instead.

Tom
  • 16,842
  • 17
  • 45
  • 54
Sid
  • 11
  • 2

1 Answers1

0

Since String objects in Java don't have an encoding, and only byte arrays can support different encodings. Looks like you want to work on UTF-8 data, which you can do using byte arrays.

Try converting your String to byte[] with desired encoding, and then reconstruct your String.

Atul Kumar
  • 421
  • 3
  • 12