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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:20:35+00:00 2026-06-17T23:20:35+00:00

I have problem with decoding parameters sent by Flash Player HttpService (data from Spark

  • 0

I have problem with decoding parameters sent by Flash Player HttpService (data from Spark Form) and received in Java Servlet. This is client code of HttpService and Form:

<mx:HTTPService id="submitForm" result="onResultSend(event)" method="POST" url="{EVMServerConnection.SERVER_ADDRESS}/UserSubmitionServlet" useProxy="false" resultFormat="text">
        <mx:request xmlns="">
            <login>{login.text}</login>
            <password>{password.text}</password>
            <email>{email.text}</email>
            <userName>{userName.text}</userName>
            <secondName>{secondName.text}</secondName>
            <gender>{String(gender.selectedItem)}</gender>
            <countryKey>{String(country.selectedItem)}</countryKey>
            <city>{city.text}</city>
            <dateOfBirth>{String(dayOfBirth.selectedItem) + String(monthOfBirth.selectedItem) + String(yearOfBirth.selectedItem)}</dateOfBirth>
        </mx:request> 
    </mx:HTTPService>

The servlet method:

private void registerUser(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
    //request.setCharacterEncoding("UTF-16LE");
    System.out.println(request.getCharacterEncoding());
    String login = request.getParameter("login");
    String password = request.getParameter("password");
    String email = request.getParameter("email");
    //String userName = DataUtils.getUTF8FromUTF16String( request.getParameter("userName") );
    //String userName = request.getParameter("userName");
    byte[] bytes = request.getParameter("userName").getBytes();
    String userName = new String(bytes , "Unicode" );
    System.out.println("UserName: " + userName);
    String secondName = request.getParameter("secondName");
    String gender = request.getParameter("gender");
    boolean isMale = false;
    if (gender != null)
        isMale = !gender.equals("1");
    //String countryKey = request.getParameter("countryKey");
    String city = request.getParameter("city");
    String dateOfBirth = request.getParameter("dateOfBirth");
    Date dateDateOfBirth = null;

When I try to display userName on console i get Chinese signs though it should be Polish letters. I tried to use UTF-16, UTF-16LE, UTF-16BE instead of Unicode parameter in new String() but the results were similar.

  • 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-17T23:20:36+00:00Added an answer on June 17, 2026 at 11:20 pm

    Helpful was class offered by Apache Tomcat 7, which I am using. I have added SetCharacterEncodingFilter in my web.xml, and now everything works fine and I can read parameters in ordinary way (by String name = request.getParameter(“name”) )

    ...
    <filter>
        <filter-name>SetCharacterEncoding</filter-name>
        <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>SetCharacterEncoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem for decoding image data from base 64 encoded string. I
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have a Java application decoding a UTF-8 encoded String received over the wire
I have a problem involving encoding/decoding. I read text from file and compare it
My team and I have this nasty problem with parsing a string received from
I have a problem decoding HTML entities. I have tried using both System.Net.WebUtility.HtmlDecode() and
I have problem with show or hide form in Window Form Application. I start
I have problem with UIWebView delay when the load image from url. In my
I have problem while loading data into html select when users press or click
I have problem with returning first letter from string, when that letter is language

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.