468,120 Members | 1,919 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,120 developers. It's quick & easy.

ansi to oem conversion with borland C3.1

Hi,

I'm trying to read the belgium eid card which gives out utf8, i can
convert it to ansi but now i have the problem of converting the special
chart to oem.
utf8 to ansi
for(x=0;x<lengte;x++){
if((SubPart[x]&0x80)==0) printf("%c",SubPart[x]);
else{
unsigned char y;
y=((SubPart[x]&0x1F)<<6)|SubPart[x+1]&0x3F;
x++;
printf("%c",y);
printf("|%d|",y);
}
}
printf("\n");

Now the problem is that "+" () is displayed as so i need to
convert it back to .
In but there is no ansi to oem convertor is borland C 3.1.

Regards
Laery

Feb 17 '06 #1
3 3104
Hi,

I found the answer using pc8 code table.

unsigned int oem[257]={
0, 1, 2, 3, 4, 5, 6, 7, // # 0 - 7
8, 9, 10, 11, 12, 13, 14, 15, // # 8 - 15
16, 17, 18, 19, 182, 186, 22, 23, // # 16 - 23
24, 25, 26, 27, 28, 29, 30, 31, // # 24 - 31
32, 33, 34, 35, 36, 37, 38, 39, // # 32 - 39
40, 41, 42, 43, 44, 45, 46, 47, // # 40 - 47
48, 49, 50, 51, 52, 53, 54, 55, // # 48 - 55
56, 57, 58, 59, 60, 61, 62, 63, // # 56 - 63
64, 65, 66, 67, 68, 69, 70, 71, // # 64 - 71
72, 73, 74, 75, 76, 77, 78, 79, // # 72 - 79
80, 81, 82, 83, 84, 85, 86, 87, // # 80 - 87
88, 89, 90, 91, 92, 93, 94, 95, // # 88 - 95
96, 97, 98, 99, 100, 101, 102, 103, // # 96 - 103
104, 105, 106, 107, 108, 109, 110, 111, // # 104 - 111
112, 113, 114, 115, 116, 117, 118, 119, // # 112 - 119
120, 121, 122, 123, 124, 125, 126, 127, // # 120 - 127
199, 252, 233, 226, 228, 224, 229, 231, // # 128 - 135
234, 235, 232, 239, 238, 236, 196, 197, // # 136 - 143
201, 181, 198, 244, 247, 242, 251, 249, // # 144 - 151
223, 214, 220, 243, 183, 209, 158, 159, // # 152 - 159
255, 173, 155, 156, 177, 157, 188, 21, // # 160 - 167
191, 169, 166, 174, 170, 237, 189, 187, // # 168 - 175
248, 241, 253, 179, 180, 230, 20, 250, // # 176 - 183
184, 185, 167, 175, 172, 171, 190, 168, // # 184 - 191
192, 193, 194, 195, 142, 143, 146, 128, // # 192 - 199
200, 144, 202, 203, 204, 205, 206, 207, // # 200 - 207
208, 165, 210, 211, 212, 213, 153, 215, // # 208 - 215
216, 217, 218, 219, 154, 221, 222, 225, // # 216 - 223
133, 160, 131, 227, 132, 134, 145, 135, // # 224 - 231
138, 130, 136, 137, 141, 161, 140, 139, // # 232 - 239
240, 164, 149, 162, 147, 245, 148, 246, // # 240 - 247
176, 151, 163, 150, 129, 178, 254, 152 // # 248 - 255
}
if(y>127){
printf("!%c!",oem[y]);
}

Regards
Laery
th******@hotpop.com schreef:
Hi,

I'm trying to read the belgium eid card which gives out utf8, i can
convert it to ansi but now i have the problem of converting the special
chart to oem.
utf8 to ansi
for(x=0;x<lengte;x++){
if((SubPart[x]&0x80)==0) printf("%c",SubPart[x]);
else{
unsigned char y;
y=((SubPart[x]&0x1F)<<6)|SubPart[x+1]&0x3F;
x++;
printf("%c",y);
printf("|%d|",y);
}
}
printf("\n");

Now the problem is that "+" () is displayed as so i need to
convert it back to .
In but there is no ansi to oem convertor is borland C 3.1.

Regards
Laery


Feb 17 '06 #2
Hi,

I found the answer using pc8 code table.

unsigned int oem[257]={
0, 1, 2, 3, 4, 5, 6, 7, // # 0 - 7
8, 9, 10, 11, 12, 13, 14, 15, // # 8 - 15
16, 17, 18, 19, 182, 186, 22, 23, // # 16 - 23
24, 25, 26, 27, 28, 29, 30, 31, // # 24 - 31
32, 33, 34, 35, 36, 37, 38, 39, // # 32 - 39
40, 41, 42, 43, 44, 45, 46, 47, // # 40 - 47
48, 49, 50, 51, 52, 53, 54, 55, // # 48 - 55
56, 57, 58, 59, 60, 61, 62, 63, // # 56 - 63
64, 65, 66, 67, 68, 69, 70, 71, // # 64 - 71
72, 73, 74, 75, 76, 77, 78, 79, // # 72 - 79
80, 81, 82, 83, 84, 85, 86, 87, // # 80 - 87
88, 89, 90, 91, 92, 93, 94, 95, // # 88 - 95
96, 97, 98, 99, 100, 101, 102, 103, // # 96 - 103
104, 105, 106, 107, 108, 109, 110, 111, // # 104 - 111
112, 113, 114, 115, 116, 117, 118, 119, // # 112 - 119
120, 121, 122, 123, 124, 125, 126, 127, // # 120 - 127
199, 252, 233, 226, 228, 224, 229, 231, // # 128 - 135
234, 235, 232, 239, 238, 236, 196, 197, // # 136 - 143
201, 181, 198, 244, 247, 242, 251, 249, // # 144 - 151
223, 214, 220, 243, 183, 209, 158, 159, // # 152 - 159
255, 173, 155, 156, 177, 157, 188, 21, // # 160 - 167
191, 169, 166, 174, 170, 237, 189, 187, // # 168 - 175
248, 241, 253, 179, 180, 230, 20, 250, // # 176 - 183
184, 185, 167, 175, 172, 171, 190, 168, // # 184 - 191
192, 193, 194, 195, 142, 143, 146, 128, // # 192 - 199
200, 144, 202, 203, 204, 205, 206, 207, // # 200 - 207
208, 165, 210, 211, 212, 213, 153, 215, // # 208 - 215
216, 217, 218, 219, 154, 221, 222, 225, // # 216 - 223
133, 160, 131, 227, 132, 134, 145, 135, // # 224 - 231
138, 130, 136, 137, 141, 161, 140, 139, // # 232 - 239
240, 164, 149, 162, 147, 245, 148, 246, // # 240 - 247
176, 151, 163, 150, 129, 178, 254, 152 // # 248 - 255
}
if(y>127){
printf("!%c!",oem[y]);
}

Regards
Laery
th******@hotpop.com schreef:
Hi,

I'm trying to read the belgium eid card which gives out utf8, i can
convert it to ansi but now i have the problem of converting the special
chart to oem.
utf8 to ansi
for(x=0;x<lengte;x++){
if((SubPart[x]&0x80)==0) printf("%c",SubPart[x]);
else{
unsigned char y;
y=((SubPart[x]&0x1F)<<6)|SubPart[x+1]&0x3F;
x++;
printf("%c",y);
printf("|%d|",y);
}
}
printf("\n");

Now the problem is that "+" () is displayed as so i need to
convert it back to .
In but there is no ansi to oem convertor is borland C 3.1.

Regards
Laery


Feb 17 '06 #3
On 17 Feb 2006 02:59:01 -0800, "th******@hotpop.com"
<th******@hotpop.com> wrote in comp.lang.c:
Hi,

I'm trying to read the belgium eid card which gives out utf8, i can
convert it to ansi but now i have the problem of converting the special
chart to oem.
utf8 to ansi
for(x=0;x<lengte;x++){
if((SubPart[x]&0x80)==0) printf("%c",SubPart[x]);
else{
unsigned char y;
y=((SubPart[x]&0x1F)<<6)|SubPart[x+1]&0x3F;
x++;
printf("%c",y);
printf("|%d|",y);
}
}
printf("\n");

Now the problem is that "+" () is displayed as so i need to
convert it back to .
In but there is no ansi to oem convertor is borland C 3.1.

Regards
Laery


The C language knows nothing at all about "ansi" or "oem". Nor does
it know anything at all about glyphs, which is a term for the visual
appearance of a character produced by some sort of output device,
whether it be a video screen, a printer, or something else.

If you have the correct numerical value but your display devise shows
a different glyph that the one you want, you need to investigate the
use of things like font types, code pages, or locales in your compiler
and/or operating system.

You don't mention whether you are using Borland 3.1 for MS-DOS or for
Windows, perhaps your best bet would be in one of Borland's support in
the new:borland.public.* family on the server newsgroups.borland.com.

In any case, this is not a C language issue at all.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Feb 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Thomas Matthews | last post: by
3 posts views Thread by Siemel Naran | last post: by
100 posts views Thread by Roose | last post: by
20 posts views Thread by ritchie | last post: by
1 post views Thread by wschlanger | last post: by
reply views Thread by info | last post: by
16 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.