https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112008-12-31T18:10:51ZRuby Issue Tracking SystemRuby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=24772008-12-31T18:10:51Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul></ul><p>=begin<br>
I can confirm that this problem happens. Adding a</p>
<p>#elif defined(<strong>CYGWIN</strong>)</p>
<p>option as the second choice in rb_locale_charmap in encoding.c should be a good start.<br>
For the actual functionality, I think the best choice is<br>
<a href="http://www.cl.cam.ac.uk/~mgk25/ucs/langinfo.c" class="external">http://www.cl.cam.ac.uk/~mgk25/ucs/langinfo.c</a><br>
There is also <a href="http://www.haible.de/bruno/packages-libcharset.html" class="external">http://www.haible.de/bruno/packages-libcharset.html</a>,<br>
but that's GNU, so it would create a copyright problem.</p>
<p>I guess the next steps would be to add the above langinfo.c to<br>
the missing directory, probably changing the function name to<br>
avoid conflicts with the existing (but useless) nl_langinfo.</p>
<p>I could easily do that, but I'd need some advice or help re.<br>
makefiles. Nobu, Yui, anybody?</p>
<p>Regards, Martin.<br>
=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=24972009-01-01T16:59:46Zyugui (Yuki Sonoda)yugui@yugui.jp
<ul><li><strong>Target version</strong> set to <i>1.9.1 RC2</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=25232009-01-04T15:47:05Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
Applied in changeset r21311.<br>
=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=25252009-01-04T18:17:27Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><p>=begin<br>
The patch committed by Nobu uses the Windows 'locale' for cygwin,<br>
which is a good idea as a fallback. However, I personally often<br>
use cygwin with LANG=en-US.UTF-8 or so. Using putty (or another<br>
UTF-8 capable terminal emulator such as TeraTerm,...) and cygwin<br>
is often the only way to do UTF-8 work on Windows.</p>
<p>I'm not sure what Tom Link meant with "proper charset", but<br>
for me, it would be UTF-8 if I have set LANG=en-US.UTF-8.</p>
<p>Regards, Martin.<br>
=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=25602009-01-10T02:36:15Ztomel (Tom Link)micathom@gmail.com
<ul></ul><p>=begin</p>
<blockquote>
<p>proper charset</p>
</blockquote>
<p>I'm fine with any solution that makes something 8-bit clean the default charset.</p>
<p>People using cygwin's x server though can run cygwin's utf-8-capable version of rxvt. In such a case, it could cause problems if ruby relied on the windows locale.</p>
<p>A proper solution should IMHO check for LANG first and use the windows locale only if LANG isn't defined -- as proposed by Martin.</p>
<p>Anyway, I haven't tried it yet but I guess the current solution is ok for me since I personally use the non-utf-8 windows rxvt terminal. Thanks.</p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=25842009-01-13T03:13:00Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Hi,</p>
<p>At Sat, 10 Jan 2009 02:35:50 +0900,<br>
Tom Link wrote in <a href="https://blade.ruby-lang.org/ruby-core/21239">[ruby-core:21239]</a>:</p>
<blockquote>
<p>A proper solution should IMHO check for LANG first and use<br>
the windows locale only if LANG isn't defined -- as proposed<br>
by Martin.</p>
</blockquote>
<p>It's working so.</p>
<p>--<br>
Nobu Nakada</p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=26182009-01-14T18:12:57Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul></ul><p>=begin<br>
At 03:11 09/01/13, you wrote:</p>
<blockquote>
<p>Hi,</p>
<p>At Sat, 10 Jan 2009 02:35:50 +0900,<br>
Tom Link wrote in <a href="https://blade.ruby-lang.org/ruby-core/21239">[ruby-core:21239]</a>:</p>
<blockquote>
<p>A proper solution should IMHO check for LANG first and use<br>
the windows locale only if LANG isn't defined -- as proposed<br>
by Martin.</p>
</blockquote>
<p>It's working so.</p>
</blockquote>
<p>That's not true. Currently, Encoding.default_external defaults<br>
to US-ASCII if LANG is not set on cygwin, not to the windows<br>
locale encoding.</p>
<p>We can leave it at that, or we can fix it.</p>
<p>Regards, Martin.</p>
<p>#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University<br>
#-#-# <a href="http://www.sw.it.aoyama.ac.jp" class="external">http://www.sw.it.aoyama.ac.jp</a> <a href="mailto:duerst@it.aoyama.ac.jp" class="email">mailto:duerst@it.aoyama.ac.jp</a></p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=26262009-01-15T11:04:37Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Hi,</p>
<p>At Wed, 14 Jan 2009 18:11:36 +0900,<br>
Martin Duerst wrote in <a href="https://blade.ruby-lang.org/ruby-core/21341">[ruby-core:21341]</a>:</p>
<blockquote>
<blockquote>
<p>At Sat, 10 Jan 2009 02:35:50 +0900,<br>
Tom Link wrote in <a href="https://blade.ruby-lang.org/ruby-core/21239">[ruby-core:21239]</a>:</p>
<blockquote>
<p>A proper solution should IMHO check for LANG first and use<br>
the windows locale only if LANG isn't defined -- as proposed<br>
by Martin.</p>
</blockquote>
<p>It's working so.</p>
</blockquote>
<p>That's not true. Currently, Encoding.default_external defaults<br>
to US-ASCII if LANG is not set on cygwin, not to the windows<br>
locale encoding.</p>
</blockquote>
<p>Sorry, I'd missed to commit it.</p>
<p>--<br>
Nobu Nakada</p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=26302009-01-15T14:43:35Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul></ul><p>=begin<br>
Hello Nobu,</p>
<p>Many thanks for fixing it. I'm going to add some text from<br>
missing/langinfo.c to LICENSE (anybody, please tell me if<br>
that was wrong), and inform the author about the changes we<br>
made, and close the bug.</p>
<p>Regards, Martin.</p>
<p>At 11:03 09/01/15, Nobuyoshi Nakada wrote:</p>
<blockquote>
<p>Hi,</p>
<p>At Wed, 14 Jan 2009 18:11:36 +0900,<br>
Martin Duerst wrote in <a href="https://blade.ruby-lang.org/ruby-core/21341">[ruby-core:21341]</a>:</p>
<blockquote>
<blockquote>
<p>At Sat, 10 Jan 2009 02:35:50 +0900,<br>
Tom Link wrote in <a href="https://blade.ruby-lang.org/ruby-core/21239">[ruby-core:21239]</a>:</p>
<blockquote>
<p>A proper solution should IMHO check for LANG first and use<br>
the windows locale only if LANG isn't defined -- as proposed<br>
by Martin.</p>
</blockquote>
<p>It's working so.</p>
</blockquote>
<p>That's not true. Currently, Encoding.default_external defaults<br>
to US-ASCII if LANG is not set on cygwin, not to the windows<br>
locale encoding.</p>
</blockquote>
<p>Sorry, I'd missed to commit it.</p>
<p>--<br>
Nobu Nakada</p>
</blockquote>
<p>#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University<br>
#-#-# <a href="http://www.sw.it.aoyama.ac.jp" class="external">http://www.sw.it.aoyama.ac.jp</a> <a href="mailto:duerst@it.aoyama.ac.jp" class="email">mailto:duerst@it.aoyama.ac.jp</a></p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=26322009-01-15T14:44:20Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #956: Encoding: nl_langinfo(CODESET) on cygwin 1.5 always returns US-ASCIIhttps://redmine.ruby-lang.org/issues/956?journal_id=29312009-02-03T00:56:07Ztomel (Tom Link)micathom@gmail.com
<ul></ul><p>=begin<br>
It seems that the locale recognition doesn't work 100% or maybe I'm just doing it wrong.</p>
<p>On cygwin, the default external encoding is cp850. If I set LANG=de_DE.UTF-8, then</p>
<p>rube -e "Encoding.default_external"<br>
=> UTF-8</p>
<p>gives the correct value. But if I set it to LANG=de_DE.ISO-8859-1, then</p>
<p>rube -e "Encoding.default_external"<br>
=> CP850</p>
<p>returns the windows default locale. Since CP850 und ISO-8859-1 are incompatible encodings in the ruby mind-set, this is an unpleasant discovery.</p>
<p>=end</p>