struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26380] New: - Unable to read UTF-8 encoded app.properties
Date Fri, 23 Jan 2004 15:02:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26380>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26380

Unable to read UTF-8 encoded app.properties

           Summary: Unable to read UTF-8 encoded app.properties
           Product: Struts
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: vesterager@tvi.dk


Hi,

   It really sucks that you have to send your .properties-files through the 
native2ascii converter and get some unreadable gibberish with \uXXXX. I 
realize that even Java doesn't support UTF-8 .properties-files, but writing a 
loader is simple:

    public static Properties loadProperties( String filename) throws Throwable 
{
        Properties result = new Properties();
        BufferedReader reader = new BufferedReader( new InputStreamReader( new 
FileInputStream( filename), "UTF-8"));
        String read = reader.readLine();
        while( read != null) {
            if( !read.startsWith( "#") && !read.startsWith( ";") && 
read.indexOf( '=') != -1)
                result.setProperty( read.substring( 0, read.indexOf( '=')), 
read.substring( read.indexOf( '=')+1, read.length()));
            read = reader.readLine();
        }
        return result;
    }

   Maybe an encoding-attribute could be thrown into the <message-resources>-
tag in struts-config.xml?

Regards,
Torben Vesterager

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message