[#44237] Float を利用するRubyプログラム — SASADA Koichi <ko1@...>

 ささだです.

16 messages 2007/11/17
[#44241] Re: Float を利用するRubyプログラム — SASADA Koichi <ko1@...> 2007/11/19

 ささだです.

[ruby-list:44207] REXML で UTF16 のファイルが読み込めない

From: <rook401@...>
Date: 2007-11-12 01:42:35 UTC
List: ruby-list #44207
REXML で UTF16 のファイルを読み込もうとするとエラーになります。
上手な対処法があるのでしょうか?

- test.rb -------------------------
require 'rexml/document'

doc = nil
File.open('u16.xml') {|f|
  doc = REXML::Document.new f.read
}
-----------------------------------

>ruby -vr rexml/rexml -e "puts REXML::Version"
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
3.1.7.1

>ruby test.rb
C:/Ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:90:in `parse': #<REXML::ParseException: malformed XML: missing tag start (REXML::ParseException)
Line:
Position:
Last 80 unconsumed characters:
 > x m l  v e r s i o n = " 1 . 0 "  e n c o d i n g  = " U T F - 1 6 " ? >
C:/Ruby/lib/ruby/1.8/rexml/parsers/baseparser.rb:346:in `pull'
C:/Ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse'
C:/Ruby/lib/ruby/1.8/rexml/document.rb:204:in `build'
C:/Ruby/lib/ruby/1.8/rexml/document.rb:42:in `initialize'

  

 
---------------------------------
New Design Yahoo! JAPAN  2008/01/01

In This Thread

Prev Next