Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6682363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:41:50+00:00 2026-05-26T04:41:50+00:00

I have written jsp page in which i create String with gb2312 charset, Then

  • 0

I have written jsp page in which i create String with gb2312 charset, Then i pass the string to the JSP Page. But in the jsp page i have give pageencoding and meta tag as UTF-8. I am expecting that the characters have to be displayed as junk one and after i change character encoding in browser as gb2312 it has to be displayed correctly. But what actually happen was in UTf-8 itself it displayed as correct one. But when i change that to gb2312 Character encoding it has been displayed as junk one. Please Help. What am i doing wrong. Help to correct me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:41:50+00:00Added an answer on May 26, 2026 at 4:41 am

    A String doesn’t have an encoding. It is just an array of chars, and each char has a universal unicode value.

    It’s only when the chars must be transformed into bytes, to be saved in a file or streamed to a browser, that the encoding is used to transform chars into bytes.

    Since you said in your JSP’s page encoding directive that it had to use UTF-8, your string has been encoded as UTF-8. The browser knows that it’s UTF-8 thanks to a response header, and thus transforms the bytes it receives from the server into chars correctly.

    If you tell the browser to ignore the encoding set as a response header, and use gb2312, the browser will try to interpret the bytes as gb2312, and since it’s UTF-8, it will display incorrect chars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 pages written in JSP the first page contains: <%@page contentType=text/html pageEncoding=UTF-8%>
I have jsp file: <%@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8%> <%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core%>
iam having a jsp page Index.jsp which accept a only unicode string as its
I have written a jsp redirect in my jsp page like this <s:if test=#session.Doctor
I have written a small JSP page that contains a text box and a
in sign.jsp , I have written the following so that, if a user is
I have written a class in python that implements __str__(self) but when I use
I have written a PHP application which requires storage of millions of integers between
I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create
I have written a DB2 query to do the following: Create a temp table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.