Project

General

Profile

This project is closed and read-only.

Actions

Backport #7996

closed

Non-existent code page on certain windows XP versions

Backport #7996: Non-existent code page on certain windows XP versions

Added by mmeltner (Michael Meltner) over 13 years ago. Updated over 13 years ago.


Description

Hello,

I try to run ruby 2.0.0p0 on a machine having Windows XP embedded. This causes a core dump. I tracked to problem to "win32/file.c", convert_mb_to_wchar.

Here the conversion is done from ascii 7 bit to wchar using MultiByteToWideChar. This function returns 0 (instead of the length) as this Windows XP embedded has no coding support for code page 20217(us ascii). So MultiByteToWideChar returns an error indicating failure.

I changed the default coding page to 1252 as this is supported on all windows versions and this coding page should be identical with ascii 7 bit for the range 0x20-0x7f (or am I wrong here?)

So I made this patch which works fine:

diff -rupN ruby-2.0.0-p0/win32/file.c ruby-2.0.0-p0.new/win32/file.c
--- ruby-2.0.0-p0/win32/file.c 2012-11-17 18:53:21 +0100
+++ ruby-2.0.0-p0.new/win32/file.c 2013-02-28 11:43:29 +0100
@@ -212,9 +212,10 @@ code_page(rb_encoding *enc)
names_ary = rb_funcall(encoding, names, 0);
}

  • /* map US-ASCII and ASCII-8bit as code page 20127 (us-ascii) */
  • /* map US-ASCII and ASCII-8bit as code page 1252 (us-ascii) */
  • /* code page 20127 (us-ascii) is not available on older WinXP systems*/
    if (enc == rb_usascii_encoding() || enc == rb_ascii8bit_encoding()) {
  • UINT code_page = 20127;
  • UINT code_page = 1252;
    rb_hash_aset(rb_code_page, name_key, INT2FIX(code_page));
    return code_page;
    }
  • Michael

Updated by naruse (Yui NARUSE) over 13 years ago Actions #1

  • Tracker changed from Backport to Bug
  • Project changed from 15 to Ruby
  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

Updated by usa (Usaku NAKAMURA) over 13 years ago Actions #2

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40003.
Michael, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.
    fix [ruby-core:53079] [Bug #7996]
    reported and patched by mmeltner (Michael Meltner).

Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago Actions #3

  • Assignee changed from usa (Usaku NAKAMURA) to nagachika (Tomoyuki Chikanaga)
  • Tracker changed from Bug to Backport
  • Project changed from Ruby to 15
  • Status changed from Closed to Assigned

I think this is a regression of 2.0.0, because fixed lines are introduced at r36811 (2012-08-24).

Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago Actions #4

  • Status changed from Assigned to Closed

This issue was solved with changeset r40293.
Michael, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 40003: [Backport #7996]

* win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.
  fix [ruby-core:53079] [Bug #7996]
  reported and patched by mmeltner (Michael Meltner).
  reported by mitchellh (Mitchell Hashimoto).
Actions

Also available in: PDF Atom