Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13760

Re: wchar_t is useless

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.lang.c
Subject Re: wchar_t is useless
Date 2011-11-22 01:57 +0000
Organization A noiseless patient Spider
Message-ID <20111121172147.145@kylheku.com> (permalink)
References <jadmcb$b90$1@oravannahka.helsinki.fi> <20111121125000.483@kylheku.com> <jaei3p$4uo$1@oravannahka.helsinki.fi> <20111121150711.264@kylheku.com> <jaet4c$ffu$1@oravannahka.helsinki.fi>

Show all headers | View raw


On 2011-11-22, Lauri Alanko <la@iki.fi> wrote:
> For instance,
> character for love (U+611B), which is encoded in EUC-JP as "\xb0\xa6"
> is represented by the wchar_t value 0xb0a6.

Ah, if that's the case, that is pretty broken. \xb0\xa6 should decode into the
value 0x611B. They ducked out of doing it right, didn't they.  Perhaps this
preserves the behavior of legacy programs which expect the mapping
to work that way.

>> Simply by treating all conversions to wchar_t as targetting a common
>> representation (Unicode).
>
> You mean, rewriting all those locale modules so that wchar_t always
> has a consistent value (the unicode code point) for a given character,

Or not using/supporting the locales that don't produce Unicode code points.
You can treat those as weird legacy cruft, like EBCDIC. Find out what works,
and document that as being supported. "This is a Unicode program, whose
embedded strings are in Unicode, and which requires a Unicode-compatible
locale."

Either way, you don't have to throw out the wchar_t. It is handy because it's
supported in the form of string literals, and some useful functions like
wcsspn, wcschr, etc.

I think you have to regard these two problems as being completely separate:

- writing software that is multilingual.
- targetting two or more incompatible ways of being multilingual,
  simultaneously in the same program. (incompatible meaning that the
  internal representation for characters follows a different map.)

I think you're taking too much into your scope: you want to solve both
problems, and so then when you look at this FreeBSD mess, it looks
intractable.

Solve the first problem, and forget the second.

The only people needing to solve the second problem are those who
are saddled with legacy support requirements, like having to continue
being able to read data from 20 year old versions of the software.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

wchar_t is useless Lauri Alanko <la@iki.fi> - 2011-11-21 14:14 +0000
  Re: wchar_t is useless Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 16:17 +0000
    Re: wchar_t is useless James Kuyper <jameskuyper@verizon.net> - 2011-11-21 12:27 -0500
      Re: wchar_t is useless jgk@panix.com (Joe keane) - 2011-11-24 20:07 +0000
        Re: wchar_t is useless Kaz Kylheku <kaz@kylheku.com> - 2011-11-24 21:16 +0000
          Re: wchar_t is useless James Kuyper <jameskuyper@verizon.net> - 2011-11-24 17:15 -0500
        Re: wchar_t is useless Keith Thompson <kst-u@mib.org> - 2011-11-24 13:49 -0800
          Re: wchar_t is useless Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-27 10:33 +0000
        Re: wchar_t is useless Rui Maciel <rui.maciel@gmail.com> - 2011-11-25 14:17 +0000
          Re: wchar_t is useless Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-25 15:27 +0100
            Re: wchar_t is useless Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-25 15:29 +0100
    Re: wchar_t is useless Dann Corbit <dcorbit@connx.com> - 2011-11-22 09:50 -0800
  Re: wchar_t is useless blp@cs.stanford.edu (Ben Pfaff) - 2011-11-21 10:42 -0800
    Re: wchar_t is useless jmclnx@SPAMisBADgmail.com (Jack McCue) - 2011-11-21 19:18 +0000
    Re: wchar_t is useless Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 21:02 +0000
      Re: wchar_t is useless Lauri Alanko <la@iki.fi> - 2011-11-21 22:07 +0000
        Re: wchar_t is useless Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 23:54 +0000
          Re: wchar_t is useless Lauri Alanko <la@iki.fi> - 2011-11-22 01:15 +0000
            Re: wchar_t is useless Kaz Kylheku <kaz@kylheku.com> - 2011-11-22 01:57 +0000
              Re: wchar_t is useless Lauri Alanko <la@iki.fi> - 2011-11-22 09:28 +0000
  Re: wchar_t is useless Acid Washed China Blue Jeans <chine.bleu@yahoo.com> - 2011-11-21 11:11 -0800
  Re: wchar_t is useless "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2011-11-24 08:43 -0800
  Re: wchar_t is useless 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-24 16:42 -0800

csiph-web