Home  >  Q&A  >  body text

java - request.getsession().getattribute() garbled problem

1. Pass the value in the address bar

2. Accept the value


3. The printed username is garbled.
4. Even if the encoding is set, it will not work.

高洛峰高洛峰2697 days ago1044

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-06-23 09:15:39

    1. If it is "user" passed from the page, check if the encoding on your page is UTF-8;
    2. If it is setAttribute("user", "Zhang San") in the background of the program, then you need to check Is the encoding of the java file UTF-8?
    3. If it is the same as 2, but "Zhang San" comes from the database, then look at the string "Zhang San" which is garbled when settingAttribute;

    Summary:
    Page, background java file, database unified encoding

    reply
    0
  • 黄舟

    黄舟2017-06-23 09:15:39

    Check to see if the user is garbled when passed in,,,

    reply
    0
  • Cancelreply