Converting a unicode byte array into a ASCII-string

L

Luk Vloemans

Hey,

I'm currently working on a project to get GPS-data onto a PDA. At this
stage, I'm already getting data from the device, but my problem is: It's
rubbish. At least, it looks as if it were rubbish.

example: "`?~?\0?~?~????\0x?x?x?x?x?x~??x?x?xx?\0x?x?"

I found patterns in the code I received, so it's just encoded.

I download information byte-by-byte from the device, and store it in a
byte[] array. Because the GPS-device is made in Taiwan, the tokens are
in unicode (16-bit). The standard I'm want to use is ASCII.

Does anybody have an idea how I could translate the Unicode Byte Array
into a ASCII string ?

Thanks in advance for any assistance!

Greetz,

Luk Vloemans
IT Student
 
J

Jon Skeet

Does anybody have an idea how I could translate the Unicode Byte Array
into a ASCII string ?

See my message to your similar post a few hours ago. If that doesn't
help, please give more details.
 
L

Luk Vloemans

Hey,

I'm sorry I didn't notice your earlier response.
I tried what you said, but the end-result consists completely of
question-marks.

Perhaps I was wrong about the unicode, but I can't think of any other
explenation..

thanks anyhow for your response!

Luk
 
J

Jon Skeet

Luk Vloemans said:
I'm sorry I didn't notice your earlier response.
I tried what you said, but the end-result consists completely of
question-marks.

Perhaps I was wrong about the unicode, but I can't think of any other
explenation..

Perhaps it's unicode with the other byte order?

If you could post some example byte sequences and the characters you
expected to get out, we could try to figure it out.
 
J

Jon Skeet

Luk Vloemans said:
Okay, I'll give a few examples, but I'm afraid that what I post here, is
already (wrongly) converted to ASCII.

Hmm... that's not likely to help much, I'm afraid - can't you get it in
the raw byte array form, and post that? The trouble is that the
question marks could be anything...

What's somwhat straight is that two lines which *should* start with the
same data ($GP) don't start with the same bytes by the looks of it
(assuming the three examples you gave are meant to be the three lines
of text you posted). I don't suppose it's compressed or something like
that is it? What's the documentation for this like?

<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top