🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2037

Re: Unicode hell....

#2037
From: Bob Gonder
Date: Fri, 11 May 2007 22:51
75 lines
2680 bytes
Mike Collins wrote:

>STRINGTABLE
>{
> 1, "ASCII caption"
> 2, L"\x0421\x043f\x0440\x0430\x0432\x043a\x0430"
>}

Problem is brcc is translating each char into a word:
	0004 0032 0031 0004 etc
I wonder if MS does a better job.


I don't like this "solution" but it gets around the problem.

STRINGTABLE
BEGIN

1"\0\x41\0\x53\0\x49\0\x49\0\x20\0\x63\0\x61\0\x70\0\x74\0\x69\0\x6f\0\x6e\0\0"
 2 L"\x04\x21\x04\x3f\x04\x40\x04\x30\x04\x32\x04\x3a\x04\x30\0\0"
END

	for( int i = 1; i<3; ++i )
	{
		wchar_t	w[1000] = {0};
		wchar_t	ww[1000] = {0};
		int	nw;

		nw = LoadStringW( _hInstance, i, w, 1000 );
		BobsKludge( ww,/*1000,*/ w/*,nw*/ );

		MessageBoxW(NULL, ww, L"test", MB_OK);
	};

/* should have size constraints */
void _stdcall BobsKludge(
	wchar_t*dest,	/*int dest_len,*/ 
	wchar_t*src	/*,int src_len*/
	 )
{
	while( src[0] | src[1] )
	{	*dest = src[0]<<8 | src[1];
		++src;
		++src;
		++dest;
	}
}

Yet another method:
RC:
 4 RCDATA {L"ASCII Caption\0"}
 5 RCDATA {0x0421 0x043f 0x0440 0x0430 0x0432 0x043a 0x0430 0 0}

CODE:
	HRSRC hs;
	HGLOBAL hg;
	wchar_t *w;

	hs = FindResource( NULL, (char*)4, RT_RCDATA );
	hg = LoadResource( NULL, hs );
	w = LockResource( hg );
	MessageBoxW(NULL, w, L"RCDATA", MB_OK);

	hs = FindResource( NULL, (char*)5, RT_RCDATA );
	hg = LoadResource( NULL, hs );
	w = LockResource( hg );
	MessageBoxW(NULL, w, L"RCDATA", MB_OK);

As to how you can get the text, you might try Word, with
Insert-Symbol.
When done, save as Plain Text then Other Encoding, then Unicode.
0xfeff is added in front of your document. and the values are
	ff fe 21 04 3f 04......
Then you can do
 5 RCDATA russian.txt
Technical Details
Message-ID: <c9o94351q5pnkb47sf5gtf536gfghceq87@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4644ba20@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1b8e94d3011c4bc5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Unicode hell....
Date: Fri, 11 May 2007 15:51:53 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <c9o94351q5pnkb47sf5gtf536gfghceq87@4ax.com>
References: <4644ba20@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.85.213
X-Trace: newsgroups.borland.com 1178923911 69.69.85.213 (11 May 2007 15:51:51 -0700)
Lines: 78
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail