International characters

Arne Christian Hårseth arnechaa at online.no
Mon Apr 19 23:27:47 CEST 2004


Hi!

I am working on a Java front end to GPG and a small java library. I have 
some problems handling international characters. Using gpg.exe I can enter 
Norwegian characters (æøå) fine and I can read the Norwegian characters 
with my library by using a buffer with character set set to C865 like this:

BufferedReader gpgres = new BufferedReader(
                 new InputStreamReader(child.getInputStream(), "Cp865"));

By the way why is not gpg using UTF-8 all over (not just for input)?

When I try to make a new key from my library however, using UTF-8, when 
reading the characters back "æøå" apears like this: "µ°Õ" (note that they 
are not escaped so it seems like the UTF-encoding is OK but offset). I am 
writing by using a buffer with character set set to UTF-8 for the buffer 
like this:

BufferedWriter gpginput = new BufferedWriter(
                 new OutputStreamWriter(child.getOutputStream(), "UTF8"));

Why isn't this working? Java is using Unicode internally and I though that 
UTF characters were uniquely defines so I would think that this would be 
staight forward? How should I encode the character when writing to gpg.exe 
input?

I don't subscribe to this list so please respond to arnechaa at online.no

Arne



More information about the Gnupg-devel mailing list