[opensuse] Another slightly OT c question, howto handle extended ascii chars? >127
- From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Aug 2009 17:11:23 -0500
Listmates,
I'm parsing output that has the degree symbol in it in c. The character code
for the symbol is 167, but of course the ascii character set it limited to
0-127. Believe it or not, using a cut-n-paste into the strtok delimiter set
works, but that just feels like a cludge. Example:
const char delimiters[] = " +°,;:!-";
<snip 1st call to strtok>
token = strtok (NULL, delimiters);
Will break the string on ° correctly. But looking at how c is handling this
clude causes concern:
for (i=0;i<strlen(delimiters);i++) {
printf("%c %d\n", delimiters[i],delimiters[i]);
}
Yields:
32
+ 43
� -62
� -80
, 44
; 59
: 58
! 33
- 45
Hmm, any time I see the little � character, that's a bad sign. So, is there
any trick to handling the chars that are outside of the normal ascii chars,
but we seem to run into all the time? Is this the area of the thinly defined
wchar_t?
--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- Follow-Ups:
- Re: [opensuse] Another slightly OT c question, howto handle extended ascii chars? >127
- From: Boyd Stephen Smith Jr.
- Re: [opensuse] Another slightly OT c question, howto handle extended ascii chars? >127
- From: Michal Hrusecky
- Re: [opensuse] Another slightly OT c question, howto handle extended ascii chars? >127
- Prev by Date: Re: [opensuse] 10.3 gcc44-info install error, worth a bug?
- Next by Date: Re: [opensuse] KDE 3 users: What's missing in KDE 4.3?
- Previous by thread: [opensuse] 10.3 gcc44-info install error, worth a bug?
- Next by thread: Re: [opensuse] Another slightly OT c question, howto handle extended ascii chars? >127
- Index(es):
Relevant Pages
|