You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/11/14 10:56:48 UTC

svn commit: r474711 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java

Author: mmarinschek
Date: Tue Nov 14 01:56:47 2006
New Revision: 474711

URL: http://svn.apache.org/viewvc?view=rev&rev=474711
Log:
fix for TOMAHAWK-748: International Characters not displaying correctly - apparent encoding problem

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java?view=diff&rev=474711&r1=474710&r2=474711
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java Tue Nov 14 01:56:47 2006
@@ -53,7 +53,7 @@
      *
      * @param context FacesContext
      * @param component UIComponent
-     * @throws java.io.IOException
+     * @throws java.io.IOException if base-transport layer was not available
      */
     private void encodeJavascript(FacesContext context, UIComponent component)
                                                                         throws IOException
@@ -255,9 +255,9 @@
 
                 Object item = suggestedItem.next();
 
-                String prefix = escapeQuotes(UnicodeEncoder.encode(item.toString()).substring(0, 1)).toUpperCase();
+                String prefix = escapeQuotes(encodeSuggestString(item.toString()).substring(0, 1)).toUpperCase();
 
-                buf.append("[\"").append(UnicodeEncoder.encode(escapeQuotes(item.toString()))).append("\",\"")
+                buf.append("[\"").append(encodeSuggestString(escapeQuotes(item.toString()))).append("\",\"")
                    .append(prefix).append("\"],");
             }
         }
@@ -265,6 +265,12 @@
         buf.append("]");
 
         context.getResponseWriter().write(buf.toString());
+    }
+
+    protected String encodeSuggestString(String str)
+    {
+        //If you want UTF-8 and we don't do it, you can enable it here with UnicodeEncoder.encode()
+        return str;
     }
 
     public void decode(FacesContext facesContext, UIComponent component)