Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Problem displaying Japanese chars on Linux



Maarten

Is the environment settings the same when you run the program in  /etc/rc5.d/ and from the command line?
Also..there is a Tokyo java mailing list, it might be a good idea to post it on that list.  For details

www.ninjava.org

Cheers

Tony




On Tue, 12 Feb 2002 16:19:52 -0000
"Maarten Janson" <maartenjanson@example.com> wrote:

> Hi,
> 
> I'm involved in localizing an application that uses servlets to send data to client browsers.
> The Application is an Agent that runs as a deamon on Linux(Turbo and RH). The Agent in written in java and works like this:
> 
> from a Windows client you point a web browser to the Agent on the Japanese Linux machine and the Agent determines the locale of the client and uses this info to return the correct strings by using resource bundles. 
> 
> The problem is that when the Agent is started during boot of the Japanese Linux machine and you point the browser on a Japanese windows machine to it you see questionmarks. If I then stop the Agent on the Linux machine and restart then the client displays proper Japanese characters. I did some debugging and wrote a small java program (test_resource.java) to display this behaviour, I have listed test_resource.java below, together with the 2 properties files. 
> 
> If you run test_resource during boot (create S99Test in /etc/rc5.d and have S99Test to run test_resource and redirect output to a file) then you will see that the correct properties file is loaded and that the english chars in the resource string appear fine but the japanese chars appear as ????? If you then run test_resource from an xterm window the the japanese chars display fine as well.
> 
> In test_resource I set the default Locale in order to make sure it is set correctly (see bug ID4127375)
> 
> Does anyone have an idea what happens here? Is there a reason for the fact that if the agent gets started during boot that it can not display japanese chars and if started from a console it can?
> 
> Thanks
> 
> Maarten
> 
> ---- test_resource.java ----
> import java.text.*;
> import java.util.*;
> 
> public class test_resource
> {
> public static void main(String args[])
> {
> String theResourceFile = "test_prop";
> String kName = "name";
> 
> String[] theResourceKeys =
> {
> kName
> };
> System.out.println("Locale.getDefault = " + Locale.getDefault().toString());
> Locale theLocale = new Locale("ja","JP");
> 
> Locale.setDefault(theLocale);
> System.out.println("Locale.getDefault after setDefault = " + Locale.getDefault().toString()); 
> 
> 
> ResourceBundle bundle = ResourceBundle.getBundle(theResourceFile, theLocale);
> System.out.println("bundle = ResourceBundle.getBundle(test_prop, Locale(ja,JP))");
> String Name = bundle.getString(kName);
> System.out.println("String Name = bundle.getString(kName);");
> System.out.println("Name = " + Name);
> 
> 
> 
> } 
> 
> 
> }
> 
> ---- test_prop_ja.properties
> name=begin \uff95\uff70\uff7b\uff9e\u540d end
> 
> --- test_prop.properties
> name=name
> 
> 
> 
> 


_________________________________________________________
Do You Yahoo!?
Get your free @example.com address at http://mail.yahoo.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links