This site is no longer active and is available for archival purposes only. Registration and login is disabled.

signed char problems


signed char problems

Postby Jim » Feb 18, 2002 @ 4:56pm

Having big headaches with the signed char problem.
I need to read in various text file, which are in several different languages. These text strings thus include extended ascii characters - those above 127.

As EVC++ only sees signed chars ( even with the _CHAR_UNSIGNED compiler pragma set) it gives you incorrect output values i.e

'ä'=0xe4=byte(228)=signed char(-28)
'ü'=0xfc=byte(252)=signed char(-4)
'ö'=0xf6=byte(246)=signed char(-10)

I need to obtain the correct ascii values for these letters :evil:

'ä' should give the decimal value 132.

any help would be much appreciated ( even a dirty fix would do).

Jim.
User avatar
Jim
pm Member
 
Posts: 97
Joined: Feb 8, 2002 @ 5:03pm
Location: London


Postby Dan East » Feb 18, 2002 @ 5:52pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby billcow » Feb 18, 2002 @ 5:57pm

Last edited by billcow on Feb 19, 2002 @ 6:32pm, edited 1 time in total.
Most people don't know that "A highly technical term" is actually a highly technical term used to describe something that doesn't mean anything
User avatar
billcow
pm Member
 
Posts: 81
Joined: Jan 6, 2002 @ 12:22am
Location: Dryden, NY


Postby billcow » Feb 18, 2002 @ 5:57pm

Most people don't know that "A highly technical term" is actually a highly technical term used to describe something that doesn't mean anything
User avatar
billcow
pm Member
 
Posts: 81
Joined: Jan 6, 2002 @ 12:22am
Location: Dryden, NY


Postby Jim » Feb 19, 2002 @ 11:37am

'ä' should give the decimal value 132.

char a = 'ä';
// has a decimal value of -28

unsigned char b = (unsigned char) a;
//has a decimal value of 228

how do I get the correct ansii 132 decimal value?

Jim.

ps. Am I doing somefink real dumb?
User avatar
Jim
pm Member
 
Posts: 97
Joined: Feb 8, 2002 @ 5:03pm
Location: London


Postby Dan East » Feb 19, 2002 @ 1:35pm

That makes no sense. You compiled the exact code sample you posted? How are you obtaining b's value, via the debugger?

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby refractor » Feb 19, 2002 @ 2:17pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Dan East » Feb 19, 2002 @ 2:33pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby refractor » Feb 19, 2002 @ 2:40pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Jim » Feb 19, 2002 @ 4:19pm

User avatar
Jim
pm Member
 
Posts: 97
Joined: Feb 8, 2002 @ 5:03pm
Location: London


Postby refractor » Feb 19, 2002 @ 4:35pm



This page probably answers the "why ANSI" part... but I don't know the conversion routine (maybe you'll have to go through ANSI->UNICODE->ASCII?) ... or just stick to Unicode in the first place if you can.

Cheers,

Refractor.
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum