Unicode issue with JSF and HTML?

I have a JSF generated HTML form that maps an input element to a bean installer and it seems to me that JSF is distorting unicode input in the path. In particular, I am making the following exception for testing purposes in setter

public void setTitle(String title){
    System.out.println("title set with: "+title+"\n");
    if (title.startsWith("xxx")) {
        throw new RuntimeException("debug exception "+title);
    }
    this.title = title;
}

Then I put the following text in the form header input element: "xxxx 海 陆". Then, when I submit the form, I see a printout of the magazine

title set with: xxxx ????? 

(on a Unicode-compatible Mac terminal). And I get an error on the HTML response page:

Error setting property 'title' in bean of type   
uk.ac.lancs.e_science.sakaiproject.api.blogger.post.Post: 
java.lang.RuntimeException: debug exception xxxx    ??

Any clues about what's wrong? Am I just full of this and misdiagnosed? I think that I have eliminated all other possibilities. Unicode seems to work fine in other components of the same application.

+3
2

, :

  • , (application/x-www-form-urlencoded multipart/form-data)? MIME-, . URL-, ?
  • ?
  • - ? Unicode?
  • , (, MacRoman)? - , ?

, , , Unicode,

  public static void printCodepoints(char[] s) {
    for (int i = 0; i < s.length; i++) {
      int codePoint = Character.isHighSurrogate(s[i]) ? Character
          .toCodePoint(s[i], s[++i])
          : s[i];
      System.out.println(Integer.toHexString(codePoint));
    }
  }
+3

unicode ; - unicode. ( ), , UTF-8, title .

accept-charset . .

0

Source: https://habr.com/ru/post/1708347/


All Articles