Problem Writing UniCode Data to File

Login to reply to this topic.
Thu, 2006-04-27 19:02
Joined: 2005-10-10
Forum posts: 37
Hi all,

I'm collecting Network parameters in my app using the MobInfo Library.

When i write them to file, I'm having boxes and "/" written in the place of actual data...

I think that the error is due to the Unicode convertion...

For example, the CellID value is a TUInt which displays correctly on the screen, but in the file, i get the data as [.

Signal Strength is TInt but the value i get is 

Do enlighten me on this!!!!

The Cruise is on...


Thu, 2006-04-27 19:09
Guest (not verified)
Forum posts: 2043
Re: Problem Writing UniCode Data to File
What application are you using to view the contents of the file?

Maybe the contents are actually correct unicode but you are viewing the file using notepad or similar.
Thu, 2006-04-27 19:18
Joined: 2005-10-10
Forum posts: 37
Re: Problem Writing UniCode Data to File
I'm developing for UIQ and i'm using SMan to view the contents...

On the PC, i'm using TextPad...

The Cruise is on...

Thu, 2006-04-27 19:21
Guest (not verified)
Forum posts: 2043
Re: Problem Writing UniCode Data to File
Open your file in a binary viewer, i.e. your IDE should have one and see what it looks like.
Thu, 2006-04-27 19:26
Joined: 2005-10-10
Forum posts: 37
Re: Problem Writing UniCode Data to File
I'm using Carbide.C++ and if i open the file there also, i'm getting the same issues!!!!

The \ for Cell ID and the  for Signal Strength...

The Cruise is on...

Thu, 2006-04-27 19:27
Joined: 2004-11-29
Forum posts: 1232
Re: Problem Writing UniCode Data to File
How are you writeing the values to file?
To me it looks a bit like you have written the value directly to file without converting it to a string first.
Thu, 2006-04-27 19:30
Joined: 2005-10-10
Forum posts: 37
Re: Problem Writing UniCode Data to File
Tats true alh...

I'm collecting the CellId and SignalStrength values into two variables cellid and SignalStrength... and i'm adding them to a buffer...

Code:
TBuf8<128> fileWriteBuf;
//other code
fileWriteBuf.Append(cellid().iCellId);
//other code
fileWriteBuf.Append(SignalStrength);

//some more other code...

iFile.Write(fileWriteBuf, iStatus);
iFile.Flush();

Is this wrong???

The Cruise is on...

Thu, 2006-04-27 19:32
Guest (not verified)
Forum posts: 2043
Re: Problem Writing UniCode Data to File
If its displaying those sorts of characters its not a binary viewer.
Its as alh says, you are writing binary data but viewing it with applications expecting text. If you want to be able to read the contents in a way that is intelligible to a human you have to convert it.
If you are just checking the contents of the file to see if they are correct you need a viewer which isn't expecting text date.
Thu, 2006-04-27 19:43
Joined: 2005-10-10
Forum posts: 37
Re: Problem Writing UniCode Data to File
But Mr. Guest,

The problem is i'm having the other values like IMEI, IMSI, MCC written whereas i'm having these two values not being written...

The Cruise is on...

Thu, 2006-04-27 19:50
Guest (not verified)
Forum posts: 2043
Re: Problem Writing UniCode Data to File
>>For example, the CellID value is a TUInt

>>Signal Strength is TInt


and imei is declared as a TInt or TUint also?
  • Login to reply to this topic.