~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/100_rexml_encoding.patch

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
* REXML should accept UTF-16.  [ruby-list:42737]
2
 
 
3
 
diff -ruN ruby-1.8.5.orig/lib/rexml/encoding.rb ruby-1.8.5/lib/rexml/encoding.rb
4
 
--- ruby-1.8.5.orig/lib/rexml/encoding.rb       2006-04-14 11:56:43.000000000 +0900
5
 
+++ ruby-1.8.5/lib/rexml/encoding.rb    2006-09-19 13:41:16.000000000 +0900
6
 
@@ -54,8 +54,8 @@
7
 
 
8
 
     def check_encoding str
9
 
       # We have to recognize UTF-16, LSB UTF-16, and UTF-8
10
 
-      return UTF_16 if str[0] == 254 && str[1] == 255
11
 
-      return UNILE if str[0] == 255 && str[1] == 254
12
 
+      return UTF_16 if /\A\xfe\xff/n =~ str
13
 
+      return UNILE if /\A\xff\xfe/n =~ str
14
 
       str =~ /^\s*<?xml\s*version=(['"]).*?\2\s*encoding=(["'])(.*?)\2/um
15
 
       return $1.upcase if $1
16
 
       return UTF_8
17
 
diff -ruN ruby-1.8.5.orig/lib/rexml/source.rb ruby-1.8.5/lib/rexml/source.rb
18
 
--- ruby-1.8.5.orig/lib/rexml/source.rb 2006-04-14 11:56:43.000000000 +0900
19
 
+++ ruby-1.8.5/lib/rexml/source.rb      2006-09-19 13:41:16.000000000 +0900
20
 
@@ -135,14 +135,14 @@
21
 
       # the XML spec.  If there is one, we can determine the encoding from
22
 
       # it.
23
 
       str = @source.read( 2 )
24
 
-      if (str[0] == 254 && str[1] == 255) || (str[0] == 255 && str[1] == 254)
25
 
-        @encoding = check_encoding( str )
26
 
+      if /\A(?:\xfe\xff|\xff\xfe)/n =~ str
27
 
+        self.encoding = check_encoding( str )
28
 
         @line_break = encode( '>' )
29
 
       else
30
 
         @line_break = '>'
31
 
       end
32
 
       super str+@source.readline( @line_break )
33
 
-               end
34
 
+    end
35
 
 
36
 
                def scan(pattern, cons=false)
37
 
                        rv = super