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

  • SEARCH
  • Home
  • 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 6115037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:02:42+00:00 2026-05-23T15:02:42+00:00

Due to some awkward legacy code, I need to pass some non-English text around

  • 0

Due to some awkward legacy code, I need to pass some non-English text around as ansi/ascii strings that are visibly UTF-8 encoded. For the most part, this is working alright (I’m using URLEncoder). However, now I need it to be able to output different versions of UTF-8 in different circumstances, and I don’t know how to do that.

For example, this character can be UTF-8 encoded these ways:

大
%u5927
大
%E5%A4%A7

But nothing seems to talk about the different versions, as though there is no difference. I know URLEncoder does not do the second version, because the & is a reserved character, but the second one is what I need in some instances. How can I convert the text to the specific version I want?

Specifically, it’s being passed to a .jsp that contains a library called displaytag that handles the data and displays a table without much developer input, but it doesn’t seem to have any options for setting the encoding. I know the second encoding (passed as ansi/ascii) in the above list is displays correctly without changing the .jsp, though, which is the safest option for me. I just need to get it that way.

  • 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-23T15:02:43+00:00Added an answer on May 23, 2026 at 3:02 pm

    First is the unicode code point in hex and is URL encoded, second is same in decimal and is the HTML/XML entity form.

    Never used it for your purpose but I think StringEscapeUtils escapeHtml or escapeXml should give you the second form.

    BTW the second form also has a hex version: 大

    Third looks like a conversion by a non utf-8 aware function which has converted the three bytes that in utf-8 make up the single code point separately. The third is in my view incorrect because you cannot see if it are three ascii bytes or that it is in fact utf-8.

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

Sidebar

Related Questions

Due to some datastorage limitations (noSQL) I need to store images as strings. How
Due to some messed up legacy code, I have $path = [OS specific base
I have some really complicated legacy code I've been working on that crashes when
Due to some rather bizarre architectural considerations I've had to set up something that
due to some unavoidable reasons I need to disable Google Chrome's Chrome PDF Viewer
I have some idea that it is due to some complex calculation, but i
I'm having some issues with my code. This is probably due to some design
I've been re-working some code due to a memory leak. The code is part
Due to some caching issues, I need to explicitly bypass the cache, for a
I need to run my development through nginx due to some complicated subdomain routing

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.