2 Replies Latest reply: Jan 27, 2010 6:17 AM by 843810 RSS

    Default encoding

    843810
      I try to setup a default encoding for my application
      java -Dfile.encoding=UTF-8 -jar my_app.jar
      but it doesn't help and the default encoding remains cp1251.
      How can I switch it to UTF8?

      Edited by: ssisqo on Jan 18, 2010 2:40 AM
        • 1. Re: Default encoding
          843810
          You can't, at least not completely. Just specify the encoding everywhere your app uses one. Relying on platform default settings is guaranteed to get you in trouble eventually.
          • 2. Re: Default encoding
            843810
            Rightly said. Even the internal classes of JDK uses system encoding to convert bytes to character. The data will always be corrupted in case if it is multibyte characters. The best way out is to convert the data specifying ur encoding