toupper for unicode

Hello

Im working on a project that includes read/write operations from an sd card formated with fat.If i want to use long file names the only thing i have to provide to the library are tow functions .
1
2
3
/* Unicode - OEM code conversion */
WCHAR ff_convert (WCHAR, UINT);
WCHAR ff_wtoupper (WCHAR);


I know what unicode is but i have know idea what OEM is and what kind of conversion i should do.
Does anyone know how to write those two functions?

Thanks
Do you really know what unicode is ? I've seen this reffered as utf-8, utf-16, utf-32, etc
It is all about character encoding. Windows provide APIs for converting between character encodings (MultiByteToWideChar and WideCharToMultiByte), don't know about *nix (you probably need some external library here)


If you use Visual Studio, Microsoft implement these functions for you in ctype.h:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int toupper(
   int c 
);
int _toupper(
   int c 
);
int towupper(
   wint_t c 
);
int _toupper_l(
   int c ,
   _locale_t locale
);
int _towupper_l(
   wint_t c ,
   _locale_t locale
);



In windows world "unicode" means utf-16, it seems towupper is perfect for you.
Last edited on
i didnt try it but i think it will work.
But what about the convert function?
1
2
3
4
5
6
7
8
9
10
11
12
#define _CODE_PAGE	437
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
/
/   932  - Japanese Shift-JIS (DBCS, OEM, Windows)
/   936  - Simplified Chinese GBK (DBCS, OEM, Windows)
/   949  - Korean (DBCS, OEM, Windows)
/   950  - Traditional Chinese Big5 (DBCS, OEM, Windows)
/   1250 - Central Europe (Windows)
/   1251 - Cyrillic (Windows)
/   1252 - Latin 1 (Windows)
/   1253 - Greek (Windows)
/   437  - U.S. (OEM) */


1
2
3
4
5
6
7
8
9
10
11
12
#elif _CODE_PAGE == 437	/* U.S. (OEM) */
#define _DF1S	0
#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49
,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,
0x9C,0x9D,0x9E,0x9F,0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,
0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,
0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5
,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, 0xE0,
0xE1,
0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,
0xEC,
0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}


It gives this table but i dont know what i have to do with it
Topic archived. No new replies allowed.