Ticket #130 (new defect)

Opened 5 months ago

Last modified 4 months ago

String comparison

Reported by: leandronunes Owned by: ser
Priority: highest Milestone:
Component: Other Version: 3.1.4
Severity: blocker Keywords:
Cc: Ruby version: 1.8.5
Operating system: Linux

Description

I was working in a project using web service on rails. I had a problem with a client of this web service because It was getting the a wrong result add the application crashes.

Searching the problem I found a bug in REXML on file:

/usr/lib/ruby/1.8/rexml/encoding.rb

On line 31 with the content bellow.

raise ArgumentError?, "Bad encoding name #@encoding" unless @encoding =~ /[\w-]+$/

My app always raise the error but when I look into the encoding variable I saw the string. "\"UTF-8\"", so the string never match with the regular expression /[\w-]+$/

I suggest replace this line with the code:

raise ArgumentError?, "Bad encoding name #@encoding" unless @encoding.gsub('"',) =~ /[\w-]+$/

Change History

Changed 4 months ago by rubys

A test case would be appreciated.

Note: See TracTickets for help on using tickets.