473,378 Members | 1,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Converting a unicode byte array into a ASCII-string

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

Nov 15 '05 #1
4 2256
Luk Vloemans <lu**********@student.luc.ac.be> wrote:

<snip>
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #2
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
Luk Vloemans <lu**********@student.luc.ac.be> wrote:

<snip>
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.


Nov 15 '05 #3
Luk Vloemans <lu**********@student.luc.ac.be> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #4
Luk Vloemans <lu**********@student.luc.ac.be> wrote:
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>

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Peter Wilkinson | last post by:
Hello tlistmembers, I am using the encoding function to convert unicode to ascii. At one point this code was working just fine, however, now it has broken. I am reading a text file that has is...
22
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on...
4
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE...
11
by: Patrick Van Esch | last post by:
Hello, I have the following problem of principle: in writing HTML pages containing ancient greek, there are two possibilities: one is to write the unicode characters directly (encoded as two...
0
by: Luk Vloemans | last post by:
Hi, I've got a Byte consisting of Unicode characters. (16bit) Is there an easy function to convert this Byte into an ASCII format ? Thanks for any assistance. Luk Vloemans IT Student
8
by: Mark Relly | last post by:
Hello, I was wondering if anybody knew much about Unicode strings in C#. I have a Unicode encoded string but how can I see the contents of this string so it doesn't display "???????????"? I...
24
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special...
14
by: abhi147 | last post by:
Hi , I want to convert an array of bytes like : {79,104,-37,-66,24,123,30,-26,-99,-8,80,-38,19,14,-127,-3} into Unicode character with ISO-8859-1 standard. Can anyone help me .. how should...
7
by: JTree | last post by:
Hi,all I encountered a problem when using unicode() function to fetch a webpage, I don't know why this happenned. My codes and error messages are: Code: #!/usr/bin/python #Filename: test.py...
13
by: George Sakkis | last post by:
It seems xml.etree.cElementTree.iterparse() is not unicode aware: .... print elem.text .... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 64,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.