[#48591] StringValuePtrでnull終止されてない文字列の作り方 — madoka yamamoto <yamamotomadoka@...>
5bGx5pys44Go44KC44GG44GX44G+44GZ44CCDQoNCnRydW5r44GuUnVieeOBp1Bvc3RncmVTUUzm
5 messages
2014/10/05
[#48598] Re: StringValuePtrでnull終止されてない文字列の作り方
— "NARUSE, Yui" <naruse@...>
2014/10/06
GyRCJF4kOiEiGyhCQ1J1YnkbJEIkSCQ3JEYkTxsoQlN0cmluZ1ZhbHVlUHRyGyRCJCwbKEJOVUwb
[#48666] Re: [ruby-cvs:55171] duerst:r48021 (trunk): common.mk: Added a rule to generate lib/unicode_normalize/tables.rb. — "Martin J. Dürst" <duerst@...>
=E4=B8=AD=E7=94=B0=E3=81=95=E3=82=93=E3=80=81=E3=81=93=E3=82=93=E3=81=AB=E3=
3 messages
2014/10/19
[ruby-dev:48686] [ruby-trunk - Bug #10418] [Assigned] REXML's encoding is broken if reading UTF-16 XML and Encondig.default_internal is set
From:
usa@...
Date:
2014-10-22 16:08:35 UTC
List:
ruby-dev #48686
Issue #10418 has been reported by Usaku NAKAMURA.
----------------------------------------
Bug #10418: REXML's encoding is broken if reading UTF-16 XML and Encondig.d=
efault_internal is set
https://bugs.ruby-lang.org/issues/10418
* Author: Usaku NAKAMURA
* Status: Assigned
* Priority: Normal
* Assignee: Kouhei Sutou
* Category: lib
* Target version: current: 2.2.0
* ruby -v: -
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
`Encoding.default_internal`=E3=81=8C=E3=82=BB=E3=83=83=E3=83=88=E3=81=95=E3=
=82=8C=E3=81=A6=E3=81=84=E3=82=8B=E7=8A=B6=E6=85=8B=E3=81=A7REXML=E3=81=ABU=
TF-16=E3=81=AAIO=E3=82=92=E9=A3=9F=E3=82=8F=E3=81=9B=E3=82=8B=E3=81=A8=E3=
=80=81`REXML::Document#encoding`=E3=81=8CUTF-16=E3=81=A7=E3=81=AF=E3=81=AA=
=E3=81=8F`Encoding.default_internal`=E3=81=AB=E3=81=AA=E3=82=8A=E3=81=BE=E3=
=81=99=E3=80=82
=E4=BB=A5=E4=B8=8B=E3=83=91=E3=83=83=E3=83=81=E3=80=82
~~~
Index: lib/rexml/source.rb
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lib/rexml/source.rb (revision 48095)
+++ lib/rexml/source.rb (working copy)
@@ -285,7 +285,7 @@
case @encoding
when "UTF-16BE", "UTF-16LE"
@source.binmode
- @source.set_encoding(@encoding)
+ @source.set_encoding(@encoding, @encoding)
end
@line_break =3D encode(">")
@pending_buffer, @buffer =3D @buffer, ""
Index: test/rexml/test_encoding.rb
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- test/rexml/test_encoding.rb (revision 48095)
+++ test/rexml/test_encoding.rb (working copy)
@@ -91,8 +91,18 @@
utf16 =3D File.open(fixture_path("ticket_110_utf16.xml")) do |f|
REXML::Document.new(f)
end
- assert_equal(utf16.encoding, "UTF-16")
+ assert_equal("UTF-16", utf16.encoding)
assert( utf16[0].kind_of?(REXML::XMLDecl))
end
+
+ def test_default_internal_with_utf16
+ orig_internal =3D ::Encoding.default_internal
+ ::Encoding.default_internal =3D 'utf-8'
+ begin
+ test_ticket_110
+ ensure
+ ::Encoding.default_internal =3D orig_internal
+ end
+ end
end
end
~~~
--=20
https://bugs.ruby-lang.org/