This project is closed and read-only.
Backport #8323
closedno conversion by "bom|utf-8"
Added by nobu (Nobuyoshi Nakada) over 13 years ago. Updated over 13 years ago.
Description
Mode spec in open and etc. accepts BOM-prefix UTF encoding, however if the external and internal encodings given there are same no conversion take place regardless the actual external encoding.
Since the encoding prefixed with "BOM" is not a real encoding, but just a fallback, the conversion should honor the detected encoding by BOM.
Files
| 0001-io.c-conversion-from-bom-encoding.patch (8.76 KB) 0001-io.c-conversion-from-bom-encoding.patch | nobu (Nobuyoshi Nakada), 04/25/2013 01:42 PM |
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#1
[ruby-core:54564]
- Description updated (diff)
Sorry, miss-post to ruby-core.
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#2
[ruby-core:54566]
- File 0001-io.c-conversion-from-bom-encoding.patch added
A patch attached
Updated by naruse (Yui NARUSE) over 13 years ago
Actions
#3
[ruby-core:54569]
The patch doesn't work on following case:
% ./ruby -e'IO.write"p","a";open("p","r:BOM|utf-8:utf-8"){|f|p f.read.size}'
-e:1:in read': code converter not found (UTF-8 to UTF-8) (Encoding::ConverterNotFoundError) from -e:1:in block in
from -e:1:in
open' from -e:1:in '
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#4
[ruby-core:54571]
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#5
- File deleted (
0001-io.c-conversion-from-bom-encoding.patch)
Updated by naruse (Yui NARUSE) over 13 years ago
Actions
#6
[ruby-core:54574]
nobu (Nobuyoshi Nakada) wrote:
Updated.
OK, commit please.
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#7
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r40462.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
io.c: conversion from bom encoding
- io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is
not a real encoding name, just a fallback. so the proper conversion
should take place even if if the internal encoding is equal to the
bom-prefixed name, unless actual encoding is equal to the internal
encoding. [ruby-core:54563] [Bug #8323] - io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
found. [ruby-core:54569]
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#8
[ruby-core:54576]
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#9
- Tracker changed from Bug to Backport
- Project changed from Ruby to 15
- Category deleted (
M17N) - Status changed from Closed to Assigned
- Assignee changed from naruse (Yui NARUSE) to nagachika (Tomoyuki Chikanaga)
- Target version deleted (
2.1.0)
Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago
Actions
#10
- Status changed from Assigned to Closed
This issue was solved with changeset r40541.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 40462: [Backport #8323]
* io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is
not a real encoding name, just a fallback. so the proper conversion
should take place even if if the internal encoding is equal to the
bom-prefixed name, unless actual encoding is equal to the internal
encoding. [ruby-core:54563] [Bug #8323]
* io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
found. [ruby-core:54569]