Feature #16233
closedwinruby UTF8 Fallback for no CodePage
Description
This is to deal specifically with setting the Region to Arabic which
sets the codepage to 720. This codepage isn't recognised by Ruby which
causes it to fail during initialisation when setting up LOCALE.
This patch to Ruby is necessary to handle languages/regions on windows
where the codepage is not supported by Ruby such as Arabic which uses
codepage 720.
If the codepage is not found, the Locale falls back to UTF8.
This is a well known Ruby/Ruby on Rails issue which is described at
https://stackoverflow.com/questions/22815542/rails4-unknown-encoding-name-cp720
Opened PR: https://github.com/ruby/ruby/pull/2518
Files
Updated by duerst (Martin Dürst) about 5 years ago
If codepage 720 is not supported, then we should look at supporting it.
Updated by gabuscus (Gabriel Nagy) about 5 years ago
duerst (Martin Dürst) wrote:
If codepage 720 is not supported, then we should look at supporting it.
fair point, however investigation on this Puppet ticket: https://tickets.puppetlabs.com/browse/PA-2191 concluded that falling back to UTF-8 fixes the issue (for codepage 720 at least). we could also check the codepage when catching the ArgumentError so we fallback only in that case
edit: also I'm not sure what does adding a new codepage entail? I agree that would be the cleaner solution
Updated by hsbt (Hiroshi SHIBATA) about 5 years ago
- Tags set to patch, win, encoding
Updated by naruse (Yui NARUSE) almost 5 years ago
- Tracker changed from Bug to Feature
- Assignee set to duerst (Martin Dürst)
- Target version set to 36
- ruby -v deleted (
2.6.3) - Backport deleted (
2.5: UNKNOWN, 2.6: UNKNOWN)
It looks Ruby should support CP720.
https://web.archive.org/web/20130328005206/http://msdn.microsoft.com/en-us/goglobal/cc305157
@duerst (Martin Dürst) Could you add support for it?
Updated by duerst (Martin Dürst) almost 5 years ago
Will do, but probably not very soon, because it's now the most busy time of the year at work, sorry.
Some notes: For the encoding (onigX), windows-1256 is a replica of iso-8859-6. But windows-1256 is much more complete, while iso-8859-6 has many unassigned codepoints, so it may be a good idea to fix this if we get around to it.
Just adding an alias 'CP720' for windows-1256 is much easier.
Updated by hsbt (Hiroshi SHIBATA) over 4 years ago
- Target version changed from 36 to 3.0
Updated by gabuscus (Gabriel Nagy) about 4 years ago
duerst (Martin Dürst) wrote in #note-6:
Just adding an alias 'CP720' for windows-1256 is much easier.
Hi @duerst (Martin Dürst), sorry for digging this up. I read your comment and updated my original pull request to alias CP720 to windows-1256: https://github.com/ruby/ruby/pull/2518
Updated by larskanis (Lars Kanis) about 4 years ago
I've been notified by this issue several times, so that I finally implemented the missing codepage CP720 in https://github.com/ruby/ruby/pull/3803 . I hope it's OK to be merged.
Updated by naruse (Yui NARUSE) about 4 years ago
- Status changed from Open to Closed
Applied in changeset git|d403591b34e204a5937241025c62c877e579fbaf.
Add string encoding IBM720 alias CP720 (GH-3803)