Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are resource files compiled as UNICODE or ANSI code-page?

First - my apologies if this has been answered a hundred times over! D'oh!

But my search-fu apparently sucks, as I'm having no luck answering this basic question:

How are resources stored in the EXE/DLL? As UNICODE (UCS-2, Windows native internal character format), or as multibyte characters using the code-page of the resources block?

  • How does one embed UNICODE strings into one's resources (.rc)?
  • Can UNICODE (UCS-2) text be inserted into the language strings from within VS 2012?
  • Is Windows still using UCS-2, or is it using UTF16 internally?

I'm just looking for general answers, or links to details, rather than a detailed how-to for putting a UNICODE string into an .rc string table. Thanks!

like image 654
Mordachai Avatar asked Oct 02 '12 14:10

Mordachai


2 Answers

All resource strings in WIN32 are compiled as Unicode. See here for more info. The .rc script itself can be ANSI (using the local codepage) or UCS-2 with the appropriate BOM (reference).

like image 73
WhozCraig Avatar answered Oct 02 '22 01:10

WhozCraig


If in doubt take a look at the hex. Here the start of notepad.exe's rc file, in UTF16:

0002ed60  01 00 53 00 74 00 72 00  69 00 6e 00 67 00 46 00  |..S.t.r.i.n.g.F.|
0002ed70  69 00 6c 00 65 00 49 00  6e 00 66 00 6f 00 00 00  |i.l.e.I.n.f.o...|
0002ed80  a6 02 00 00 01 00 30 00  34 00 30 00 39 00 30 00  |......0.4.0.9.0.|
0002ed90  34 00 42 00 30 00 00 00  4c 00 16 00 01 00 43 00  |4.B.0...L.....C.|
0002eda0  6f 00 6d 00 70 00 61 00  6e 00 79 00 4e 00 61 00  |o.m.p.a.n.y.N.a.|
0002edb0  6d 00 65 00 00 00 00 00  4d 00 69 00 63 00 72 00  |m.e.....M.i.c.r.|
0002edc0  6f 00 73 00 6f 00 66 00  74 00 20 00 43 00 6f 00  |o.s.o.f.t. .C.o.|
0002edd0  72 00 70 00 6f 00 72 00  61 00 74 00 69 00 6f 00  |r.p.o.r.a.t.i.o.|
like image 27
Benj Avatar answered Oct 02 '22 01:10

Benj