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 8105515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:11:01+00:00 2026-06-06T00:11:01+00:00

I have a Java servlet that receives data from an upstream system via a

  • 0

I have a Java servlet that receives data from an upstream system via a HTTP GET request. This request includes a parameter named “text” and another named “charset” that indicates how the text parameter was encoded:

If I instruct the upstream system to send me the text TĀ and debug the servlet request params, I see the following:

request.getParameter("charset") == "UTF-16LE"
request.getParameter("text").getBytes() == [0, 84, 1, 0]

The code points (in hex) for the two characters in this string are:

[T]  0054
[Ā]  0100

I cannot figure out how to convert this byte[] back to the String "TĀ". I should mention that I don’t entirely trust the charset and suspect it may be using UTF-16BE.

  • 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-06-06T00:11:03+00:00Added an answer on June 6, 2026 at 12:11 am

    Use the String(byteArray, charset) constructor:

    byte[] bytes = { 0, 84, 1, 0 };
    String string = new String(bytes, "UTF-16BE");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this java servlet that grabs information from a form, I need to
I have a java servlet that sets a request attribute which is served for
I have a Java Servlet, which is handling a REST request. However, this is
I have a legacy Java servlet that is currently running in a Tomcat container.
I have a Java servlet from which I need to send few notifications to
I have a servlet named HelloServlet.. import java.io.*; import javax.servlet.*; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest;
I have developed a java servlet that monitors a folder on a network drive
I'm working on a setup that takes an http request (GET for testing purposes)
Possible Duplicate: How to get UTF-8 working in java webapps? I have a servlet
I have developed the following program/architecture: A) A Java servlet receives POST requests, gets

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.