myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r750445 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
Date Thu, 05 Mar 2009 12:48:06 GMT
Author: matzew
Date: Thu Mar  5 12:48:05 2009
New Revision: 750445

URL: http://svn.apache.org/viewvc?rev=750445&view=rev
Log:
TRINIDAD-1413 - getLocalizedPattern displays currency sign in Linux

Thanks to Cale Scholl for the patch

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java?rev=750445&r1=750444&r2=750445&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
Thu Mar  5 12:48:05 2009
@@ -770,7 +770,7 @@
     // http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html
     // The unicode for '¤' is: \u00A4
     // The xml hex is        : ¤
-    int idx = pattern.indexOf("¤");
+    int idx = pattern.indexOf('\u00A4');
     if (idx == -1)
       return pattern;
     
@@ -784,19 +784,19 @@
       dfs = df.getDecimalFormatSymbols();
     }
     
-    if (idx + 1 < pattern.length() && pattern.charAt(idx + 1) == '¤')
+    if (idx + 1 < pattern.length() && pattern.charAt(idx + 1) == '\u00A4')
     {
       // Matcher.quoteReplacement ensures that the replacement string is properly escaped.
       String symbol = dfs.getInternationalCurrencySymbol();
       if (symbol.length() > 0)
-        pattern = pattern.replaceFirst("¤¤", Matcher.quoteReplacement(symbol));
+        pattern = pattern.replaceAll(new String(new char[] {'\u00A4', '\u00A4'}), Matcher.quoteReplacement(symbol));
     }
     else
     {
       // Matcher.quoteReplacement ensures that the replacement string is properly escaped.
       String symbol = dfs.getCurrencySymbol();
       if (symbol.length() > 0)
-        pattern = pattern.replaceFirst("¤", Matcher.quoteReplacement(symbol));
+        pattern = pattern.replaceAll(new String(new char[] {'\u00A4'}), Matcher.quoteReplacement(symbol));
     }
     
     return pattern;



Mime
View raw message