Paul Battley dijo [Tue, Nov 15, 2011 at 10:14:28AM +0000]: > Hi, > > > $ ruby1.9.1 -e 'require "htmlentities"; > > t=HTMLEntities.new.encode("<élan>"); puts t; puts t.encoding' > > <élan> > > UTF-8 > > That's the expected behaviour: only the basic entities are escaped by > default, i.e. only that which is necessary to produce valid HTML text. > If you want the encoder to change é, you must tell it to use :decimal, > :hexadecimal, or :named entities, thus:
Yup - The problem here is that your test suite requires the resulting string's encoding to be US_ASCII (see test_should_encode_utf8_to_ascii_if_possible in ruby_1_9_test.rb), and 'é' is not part of US_ASCII. > >> HTMLEntities.new.encode("<élan>", :named) > => "<élan>" > > This error isn't a serious failure, and may indicate a subtle change > in how Ruby marks string encoding. Which version and patch level of > Ruby is it, and is it really 1.9.1, or is it 1.9.2 with a package name > of 1.9.1 (i.e. what does ruby -v say)? Right, I am running Ruby 1.9.3p0 - The reason I'm running it as 1.9.1 as it is the version-explicit binary name we use in Debian, as it's the binary compatibility level. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org