MBCS character code support

H. S. Teoh hsteoh at quickfur.ath.cx
Tue May 15 21:28:56 PDT 2012


On Wed, May 16, 2012 at 06:12:03AM +0200, Alex Rønne Petersen wrote:
> On 16-05-2012 06:04, Katayama Hirofumi MZ wrote:
> >All Japaneses and/or other Asians want native MBCS support.
> >Please let the D compiler generate Shift_JIS code for literal strings.
> 
> I really do not understand why you want to use Shift-JIS. Unicode
> has long superseded all these magical encodings used all over the
> world. Why oppose a unified encoding?
[...]

Unfortunately, Unicode is not yet universally adopted. Many of these
encodings are still widely use for various reasons. While I don't agree
that dmd should support these other encodings, and all D programs should
always use Unicode internally, I do think that we need _some_ way to
convert between encodings, probably in the way of a conversion library.

OTOH, to answer the OP, you could just put the Shift-JIS text in a
separate file, and load them into your D program at runtime as byte[]
data. If you need unusual encodings, you shouldn't be using string
literals in the first place; put them in a l10n file and use an i18n
library to translate from internal string literals to whatever encoding
the user environment requires.


T

-- 
Life would be easier if I had the source code. -- YHL


More information about the Digitalmars-d mailing list