Encoding problem
----------------

                 Key: JRUBY-2911
                 URL: http://jira.codehaus.org/browse/JRUBY-2911
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.3
         Environment: Windows XP
            Reporter: Satish Talim
            Assignee: Thomas E Enebo
             Fix For: JRuby 1.1.4, JRuby 1.1.3


# 1. JRuby source code
# jruby02.rb
require 'java'
include_class 'java.lang.String' do |package,name|
  "J#{name}"
end

ResourceBundle = java.util.ResourceBundle
Locale = java.util.Locale

lang = JString.new 'pt'
country = JString.new 'BR'

cLocale = Locale.new lang, country
msg = ResourceBundle.get_bundle 'MessagesBundle', cLocale

puts msg.get_string 'greetings'
puts msg.get_string 'welcome'


# 2. The MessagesBundle_pt_BR.properties is 
# in the same folder as the jruby02.rb program
# MessagesBundle_pt_BR.properties
greetings = Ol\u00a0
welcome = Benvindo ao Brazil


# 3. Executed the program
# jruby jruby02.rb
# and the output is
Ol 
Benvindo ao Brazil

# whereas the outputs should have been:
Olá
Benvindo ao Brazil


# The equivalent Java program works properly
import java.util.*;
public class InternationalizationEx
{
  public static void main(String[] args)
  {
    String lang, country;
    Locale cLocale;
    ResourceBundle msg;

    lang = new String("pt");
    country = new String("BR");

    cLocale = new Locale(lang, country);
    msg = ResourceBundle.getBundle("MessagesBundle", cLocale);

    System.out.println(msg.getString("greetings"));
    System.out.println(msg.getString("welcome"));
  }
}


Some encoding problem in JRuby?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to