You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Artur Wronski (JIRA)" <ji...@apache.org> on 2008/11/11 16:44:44 UTC

[jira] Created: (WICKET-1927) WicketTester.assertErrorMessages uses wrong encoding

WicketTester.assertErrorMessages uses wrong encoding
----------------------------------------------------

                 Key: WICKET-1927
                 URL: https://issues.apache.org/jira/browse/WICKET-1927
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4-M3
         Environment: Windows XP PL SP 2, Java 1.6.0_10
            Reporter: Artur Wronski


WicketTester.assertErrorMessages returns FeedbackMessages in iso-8859-1 encoding.
Because of this all tests fail when they are using non standard ascii characters  (like polish, german etc) in messages.

Wicket should AFAIK use UTF-8 encoding or one that was specified by getApplication().getMarkupSettings().setDefaultMarkupEncoding(..).

Example:

WicketTester tester = new WicketTester(new MyApp());
tester.getApplication().getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
tester.getWicketSession().setLocale(new Locale("pl", "PL"));
tester.setupRequestAndResponse();

FormTester formTester = tester.newFormTester("someForm");
[...]
formTester.submit("process");
tester.assertErrorMessages(new String[] { "Pole 'domena' musi zawierać od 3 do 32 znaków." };

gives:

junit.framework.AssertionFailedError:
expect (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków.
but was (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1927) WicketTester.assertErrorMessages uses wrong encoding

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656376#action_12656376 ] 

Juergen Donnerstag commented on WICKET-1927:
--------------------------------------------

I don't think Wicket can help you with this.
1. The operation system determines what you default locale is
2. Your IDE (e.g. Eclipse) allows you to determine a different locale for a file (e.g. *.java). On my laptop cp1252 is the default and I copied your text into a java file. While saving, Eclipse compained that the characters can not be represented by cp1252

Since Wicket at runtime does not know which locale has been used during development, the most savest way is to UTF-8 encode your String, e.g. "'foo' nie jest w\u0142a\u015Bciwym Integer.". You may use http://www.wicket-library.com/wicket-examples/unicodeconverter/ to help you with that.

> WicketTester.assertErrorMessages uses wrong encoding
> ----------------------------------------------------
>
>                 Key: WICKET-1927
>                 URL: https://issues.apache.org/jira/browse/WICKET-1927
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M3
>         Environment: Windows XP PL SP 2, Java 1.6.0_10
>            Reporter: Artur Wronski
>             Fix For: 1.4-RC2
>
>
> WicketTester.assertErrorMessages returns FeedbackMessages in iso-8859-1 encoding.
> Because of this all tests fail when they are using non standard ascii characters  (like polish, german etc) in messages.
> Wicket should AFAIK use UTF-8 encoding or one that was specified by getApplication().getMarkupSettings().setDefaultMarkupEncoding(..).
> Example:
> WicketTester tester = new WicketTester(new MyApp());
> tester.getApplication().getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
> tester.getWicketSession().setLocale(new Locale("pl", "PL"));
> tester.setupRequestAndResponse();
> FormTester formTester = tester.newFormTester("someForm");
> [...]
> formTester.submit("process");
> tester.assertErrorMessages(new String[] { "Pole 'domena' musi zawierać od 3 do 32 znaków." };
> gives:
> junit.framework.AssertionFailedError:
> expect (1):
>    Pole 'domena' musi zawierać od 3 do 32 znaków.
> but was (1):
>    Pole 'domena' musi zawierać od 3 do 32 znaków. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-1927) WicketTester.assertErrorMessages uses wrong encoding

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-1927.
----------------------------------------

       Resolution: Invalid
    Fix Version/s: 1.4-RC2

> WicketTester.assertErrorMessages uses wrong encoding
> ----------------------------------------------------
>
>                 Key: WICKET-1927
>                 URL: https://issues.apache.org/jira/browse/WICKET-1927
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M3
>         Environment: Windows XP PL SP 2, Java 1.6.0_10
>            Reporter: Artur Wronski
>             Fix For: 1.4-RC2
>
>
> WicketTester.assertErrorMessages returns FeedbackMessages in iso-8859-1 encoding.
> Because of this all tests fail when they are using non standard ascii characters  (like polish, german etc) in messages.
> Wicket should AFAIK use UTF-8 encoding or one that was specified by getApplication().getMarkupSettings().setDefaultMarkupEncoding(..).
> Example:
> WicketTester tester = new WicketTester(new MyApp());
> tester.getApplication().getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
> tester.getWicketSession().setLocale(new Locale("pl", "PL"));
> tester.setupRequestAndResponse();
> FormTester formTester = tester.newFormTester("someForm");
> [...]
> formTester.submit("process");
> tester.assertErrorMessages(new String[] { "Pole 'domena' musi zawierać od 3 do 32 znaków." };
> gives:
> junit.framework.AssertionFailedError:
> expect (1):
>    Pole 'domena' musi zawierać od 3 do 32 znaków.
> but was (1):
>    Pole 'domena' musi zawierać od 3 do 32 znaków. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.