I have the following module:
# encoding: utf-8
module RandomNameModule
def self.doesNothing(word)
str = ""
word.codepoints{|val|
str << val.chr
}
return str
end
end
and the following test:
# encoding: utf-8
require 'test/unit'
require '../src/RandomNameModule.rb'
class RandomNameTests < Test::Unit::TestCase
def testDoesNothing
sorted = WordSort.word_sort("£$&")
assert_equal("£$&", sorted)
end
end
When I run the test I get an assertion failure:
<"£$&"> expected but was
<"\xA3$&">.
This is because "£".codepoints{|x| x.chr}
returns the value \xA3
how can I make this return £