--- Comment #3 from Don <> 2010-11-23 12:33:23 PST ---
Created an attachment (id=827)
Patch against  D2 svn 767

Although the patch is relatively long, it is very mundane.
The patch adds these functions to utf.c (they are copied from druntime). These
convert single chars from UTF32 to UTF8 or UTF16.

void utf_encodeChar(unsigned char *s, dchar_t c);
void utf_encodeWchar(unsigned short *s, dchar_t c);
int utf_codeLengthChar(dchar_t c);
int utf_codeLengthWchar(dchar_t c);

Two other wrapper functions provide the interface that is actually used:
int utf_codeLength(int sz, dchar_t c);
void utf_encode(int sz, void *s, dchar_t c);

Then, these functions are used in Cat() in constfold.c
Instead of assuming a len of 1, it uses utf_codeLength; and instead of a
memcpy, it uses utf_encode.

The cases which are patched in Cat() are: TOKnull ~ dchar, dchar ~ TOKnull,
TOKstring ~ dchar.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to