You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/03/05 13:48:06 UTC

svn commit: r750445 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java

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;