By default, java uses the platform encoding. It seems that your windows
machine has a different character encoding than the linux machine, and
that's why it's working. So, you should use the String constructor with the
character encoding.

new String(bmpPath, 0, len, "your char set name");

If you're sure it's unicode, then you should try one of:

UTF-8      Eight-bit UCS Transformation Format
UTF-16BE   Sixteen-bit UCS Transformation Format, big-endian byte order
UTF-16LE   Sixteen-bit UCS Transformation Format, little-endian byte order
UTF-16     Sixteen-bit UCS Transformation Format, byte order identified by
an optional byte-order mark

You can find the full list of character sets, although most of them might
not be supported by your java implementation:

http://www.iana.org/assignments/character-sets

Cheers,

Florin

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED] Behalf Of Nicholas Pappas
Sent: Donnerstag, 27. Mai 2004 05:00
To: [EMAIL PROTECTED]
Subject: [JAVA3D] UNICODE in Java?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

        Hello all.

        This is a little off topic, but it is in the overall context of a
Java3D app... so it is kinda on topic too. :)
        I am trying to write a loader for a geometry file from a game, which
has Unicode characters (Korean) in it.  I wrote the loader and it works
in Windows, but I recently brushed off Windows completely and am now
under Linux.  When I try to load the filenames now, I get ??????.
        This is the block of code in my loader which reads the strings from
the
file:

~    /** get the number of texture files */
~    numTextures = in.readInt();

~    /** skip ahead 4 bytes */
~    in.skipBytes(4);

~    /** load the texture files strings */
~    textures = new String[numTextures];
~    for (int i=0; i < numTextures; i++) {
~      /** read in the 40 byte buffer */
~      in.read(bmpPath);

~      /** trim buffer to length and store */
~      for (len=0; len < 40; len++) {
~        if (bmpPath[len] == 0)
~          break;
~      }
~      textures[i] = new String(bmpPath, 0, len);

~      /** skip ahead 40 bytes */
~      in.skipBytes(40);
~    }

        By the time it enters the String array it is all messed up and does
not
properly represent the correct paths anymore.

        Does anyone have any suggestions on how I fix this so I can read the
Korean text in both Windows and Linux (and other OSs)?
        Thank you for any help (and, again, sorry for the OT).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAtVm05qcyxDPLrxARAhrGAJ9etPErZXin2VlQufDXIi5wJbxDAwCguUXC
UkJBdpMmzyT89vPaSGzRZZ4=
=C0LT
-----END PGP SIGNATURE-----

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to