Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl doesn't properly recognize cp1251 encoding on Solaris

Closed / Fixed1252475fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-08-05 08:57:06
Solaris use non-standard name for cp1251 charset.
nl_langinfo(CODESET) returns ansi-1251 instead of
CP1251 on most other Unices. It seems that it is only
locale on Solaris with such a property

Proposed fix is trivial:

--- tclUnixInit.c.orig  2005-08-05 12:55:15.000000000 +0400
+++ tclUnixInit.c       2005-08-05 12:55:52.000000000 +0400
@@ -81,6 +81,9 @@
 static CONST LocaleTable localeTable[] = {
 #ifdef HAVE_LANGINFO
     {"gb2312-1980",    "gb2312"},
+#ifdef __sun
+       {"ansi-1251", "cp1251"},
+#endif
 #ifdef __hpux
     {"SJIS",           "shiftjis"},
     {"eucjp",          "euc-jp"},
dgpplain2005-08-06 02:40:10
Logged In: YES 
user_id=80530


Are the #ifdef's important?

Any reason to restrict this 
encoding alias to only
Sun (-compiled) systems?
vbwagnerplain2005-08-06 03:21:59
Logged In: YES 
user_id=757679

Probably #ifdef can be safely omitted. I cannot imagine a
system, where ansi-1251 means something other than cp1251.
But same applies to hpux-specific SJIS,  eucjp etc, which
are hidden under #ifdef __hpux.

I've just modelled my patch after existing __hpux specific code.
dkf Closed ticket [1252475fff]. [History diff]2005-08-06 03:48:35
dkfplain2005-08-06 04:01:45
Logged In: YES 
user_id=79902

I've fixed this (sans #ifdefs) on HEAD and 8.4 branch.
Dratted vendors.
Log in (anonymous is fine) to add a comment.