You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/06/01 08:45:35 UTC

svn commit: r780568 - /myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java

Author: lu4242
Date: Mon Jun  1 06:45:34 2009
New Revision: 780568

URL: http://svn.apache.org/viewvc?rev=780568&view=rev
Log:
File saved on windows1252 format, so on unix version test does not work, changed characters to byte arrays or char numbers

Modified:
    myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java

Modified: myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java?rev=780568&r1=780567&r2=780568&view=diff
==============================================================================
--- myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java (original)
+++ myfaces/shared/trunk_3.0.x/core/src/test/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoderTest.java Mon Jun  1 06:45:34 2009
@@ -273,9 +273,10 @@
   
   public void testWriteNonUsAsciiOnURIAttribute() throws Exception
   {
-      // Character ü in ISO-8859-1 is %FC but on UTF-8 is %C3%BC. In this case,
+      // Character ü in ISO-8859-1 is %FC but on UTF-8 is %C3%BC. In this case,
       // it should encode as %C3%BC
-      String cad1 = "ü";//"http://myfaces.apache.org/heüll o.jsf?key=val#id";
+	  byte [] array = new byte[]{(byte)0xFC};
+      String cad1 = new String(array,"ISO-8859-1");//+(char)0xC3BC;//"http://myfaces.apache.org/heüll o.jsf?key=val#id";
       String cad2 = "%C3%BC";//"http://myfaces.apache.org/he%FCll%20o.jsf?key=val#id";
       String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");
       assertEquals(cad2, cad3);
@@ -324,13 +325,20 @@
   {
       //Note char 256 or 0x100 should not be passed or percent encoded, because it is not
       //valid for URIs.
-      String cad11 = "¡¢£¤¥¦§¨©ª«¬­®¯°±"+((char)(0xFF))+((char)(0x100));
+	  byte [] array11 = new byte[]{(byte) 0xC2,(byte) 0xA1,(byte) 0xC2,(byte) 0xA2,
+			  (byte) 0xC2,(byte) 0xA3,(byte) 0xC2,(byte) 0xA4,(byte) 0xC2,(byte) 0xA5,
+			  (byte) 0xC2,(byte) 0xA6,(byte) 0xC2,(byte) 0xA7,(byte) 0xC2,(byte) 0xA8,
+			  (byte) 0xC2,(byte) 0xA9,(byte) 0xC2,(byte) 0xAA,(byte) 0xC2,(byte) 0xAB,
+			  (byte) 0xC2,(byte) 0xAC,(byte) 0xC2,(byte) 0xAD,(byte) 0xC2,(byte) 0xAE,
+			  (byte) 0xC2,(byte) 0xAF,(byte) 0xC2,(byte) 0xB0,(byte) 0xC2,(byte) 0xB1};
+	  
+      String cad11 = new String(array11,"UTF-8") + ((char)(0xFF))+((char)(0x100));
       String cad12 = "%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
       String cad13 = HTMLEncoder.encodeURIAtributte(cad11,"UTF-8");
       assertEquals(cad12, cad13);
       
-      String cad1 = "?key=¡¢£¤¥¦§¨©ª«¬­®¯°±"+((char)(0xFF))+((char)(0x100));
+      String cad1= "?key=" + new String(array11,"UTF-8")+((char)(0xFF))+((char)(0x100));
       String cad2 = "?key=%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD"+
                      "%C2%AE%C2%AF%C2%B0%C2%B1%C3%BF%C4%80";
       String cad3 = HTMLEncoder.encodeURIAtributte(cad1,"UTF-8");