Ruby Iconv works with irb and ruby debugger but not in a unit test -
 I'm running Ruby 1.8.7, at Ubuntu 10.04 64-bit on Rebels 2.3.5. I've written a method that should take this type of string,  "Ecole À la dekovart"  and thus a file system name output  "ecole_a_la_decouverte" : 
 (Iconv.new ('US-ASCII // TRANSLIT', 'UTF-8'). Iconv "Ecole À la Decovert"). When I test this line in my code, the test always fails to say that  "cole_la_dcouverte"   "ecole_a_la_doreouverte" . The strange thing is that if I use the debugger line and the debugger console to pass the test, along with it, this line is going on manually in  irb  and . / Script / console  seems to work.   Does anyone know what is going on and why this test is failing? My only idea is to add more support to UTF-8 in any way, including Debugger or  irb , but I have the disadvantage of finding out where I want to go. 
  Thank you! 
This appears to be a problem with the locale - the same is seen in php where ( Sometimes?) Iconv functions do not work if no locale is set (which is also a locale).
 See where low-level correction is suggestive, which will give you the  setlocale 
Comments
Post a Comment