🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3884

Re: EUC<->Unicode (Curses woes on Solaris)

#3884
From: those who know me have no need o...
Date: Sat, 22 Dec 2001 04:28
39 lines
3601 bytes
<3C22320B.E5838283@compuserve.com> divulged:

>So, in our current code - despite the locale - wchar under Sun is always
>the same Sun's own form and under Windows it's UCS-2 - it does not matter
>where our Sun or Windows NT computer is a Japanese or a French one.

in fact it is implementation defined.  which is to say that it's up to the
compiler vendor to decide what they want to do, e.g., if sun feels like
making it ucs-4 when compiling v9 code but a private bastardization
otherwise that is okay as far as the standard is concerned.

in fact the implementor could choose to do it one way in even numbered
threads (or statement-line number!) and another way in odd numbered ones,
so long as they insure that the proper mojo is applied so that it works
consistently, e.g., if thread #1 puts a latin small letter a with macron
(u+0101) into a wchar_t variable, which let's say the implementation stores
using ucs-2 encoding (0x00000101), and thread #2 puts the same letter into
a variable, which let's say is stored using the system (not program) locale
(which is, for the sake of this example, iso-8859-4) if possible otherwise
some sort of encoded value (which detail i will not go into, since it isn't
necessary) which in this case means 0x000000e0, then so long as an
evaluation of var1==var2 results in `true' the implementation works and
should be acceptable.  this would naturally be completely silly, but it
would be allowed, and it shouldn't matter to your code.  why shouldn't it
matter?  because you shouldn't compare a wchar_t to anything except a
wchar_t.

since i/o is usually locale dependent there is a potential for working
programs to fail, e.g., ``env LOCALE=ISO-8859-4 some_program | env
LOCALE=ISO-8859-1 another_program'' may not work as expected if the pipe
passes a u+0101.  (some_program outputs an 0xe0 which another_program
believes is a latin small a with grave.)

all that said, i believe that most implementations will migrate to a ucs or
utf oriented encoding of the storage.  ucs-2 and utf-8 both have strong
arguments -- pro and con -- so which is most likely still a little unclear.

-- 
okay, have a sig then
Technical Details
Message-ID: <a0125102ftm@enews1.newsguy.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews1
References: <59bfe011.0112181155.77a73800@posting.google.com> <3C213653.A869531E@compuserve.com> <3C213828.435D6692@compuserve.com> <3C21E1EF.EFDADFF0@soton.sc.philips.com> <3C22320B.E5838283@compuserve.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8c9b,4ecdeed075c19330
X-Google-Attributes: gidf8c9b,public
X-Google-Thread: f6653,4ecdeed075c19330
X-Google-Attributes: gidf6653,public
X-Google-Thread: 10204d,4ecdeed075c19330
X-Google-Attributes: gid10204d,public
X-Google-Thread: fc89c,4ecdeed075c19330
X-Google-Attributes: gidfc89c,public
X-Google-Thread: fb9a0,4ecdeed075c19330
X-Google-Attributes: gidfb9a0,public
X-Google-ArrivalTime: 2001-12-21 20:50:43 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews1
From: those who know me have no need of my name <not-a-real-address@usa.net>
Newsgroups: comp.unix.programmer,comp.sys.sun.misc,comp.unix.questions,japan.comp.sun,comp.software.international
Subject: Re: EUC<->Unicode (Curses woes on Solaris)
Date: 22 Dec 2001 04:28:14 GMT
Organization: earthfriends
Lines: 39
Message-ID: <a0125102ftm@enews1.newsguy.com>
References: <59bfe011.0112181155.77a73800@posting.google.com>
 <3C213653.A869531E@compuserve.com> <3C213828.435D6692@compuserve.com>
 <3C21E1EF.EFDADFF0@soton.sc.philips.com>
 <3C22320B.E5838283@compuserve.com>
NNTP-Posting-Host: p-165.newsdawg.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
User-Agent: Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.1 (Cuyahoga Valley)