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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:10:54+00:00 2026-05-20T01:10:54+00:00

I have a page that supports multiple languages (the user can change the language

  • 0

I have a page that supports multiple languages (the user can change the language at any time).
I update the thread’s culture based on the user selection in the Initialize Culture method.

I also update the response object based on the code page for the selected country and set its charset to the WebName of the encoding used (if i don’t update the response object based on the code page, then the data bound to controls gets garbled). the resource files are also localized based on the code page.

After doing the above changes, the page is getting displayed correctly in the browser.

However, when the user enters data in one of the Asian languages, the text gets all messed up. The drop down list actually throws the invalid callback or postback argument exception.

On checking the request.contentEncoding i found that it was still UTF-8 (set in web.config).

If I change the request.ContentEncoding during BeginRequest event, the input comes in correctly. But I am not sure of the user selected language this early in the page cycle.

Is the above approach the correct way to go about it?
How can i dynamically set the encoding for the incoming request?

  • 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-20T01:10:55+00:00Added an answer on May 20, 2026 at 1:10 am

    The request is something a client have sent you. You cannot choose what he sends, it is your input. However, the client should probably be sending this input in the encoding defined on the page containing the form.

    Do you set the charset correctly on the page? Are you sure you do not send e.g.

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    

    in the HTML header, while the data is in a different encoding?

    Added after comments: If I understand it correctly, you are generating the output page in a different encoding than UTF-8 (are you sure you need to do that?). After which you have problems decoding the form data POSTed back. The simplest way would be to ensure the data gets posted back in UTF-8. For that, HTML defines the accept-charset attribute on form. However, the attribute is not supported in IE. For IE, there is a hack: you could try adding a fake <input> containing any “strange” Unicode character to force IE post as UTF-8.

    Which is not very nice, a simpler solution would be simply to use UTF-8 always – do you really need to use different encodings for your output page?

    Or, if you do need to output data in another encoding, your solution of setting Request.ContentEncoding is AFAIAA the only way you can use. To determine the encoding used, I would recommend adding a hidden field which is POSTed back (in theory, you could use HTTP headers, but I don’t think browsers send them with the POSTed data), to use something like this:

        public void Application_BeginRequest(object sender, EventArgs args)
        {
            var inputEncoding = Request.Form["hiddenEncoding"];
            if (!String.IsNullOrEmpty(inputEncoding)) Request.ContentEncoding = Encoding.GetEncoding(inputEncoding);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is hitting a webservice every 5 seconds to update
I have a page that contains a user control that is just a personalized
Hello I need to have multiple language support of my django admin application.I can
I would like it to have the following features: Supports multiple languages Allows admin
I have a page that is generated which inserts an HTML comment near the
I have a page that uses $(id).show(highlight, {}, 2000); to highlight an element when
I have a page that has an iframe From one of the pages within
I have a page that is supposed to launch the Print Preview page onload.
I have a Page that has a single instance of a UserControl that itself
We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a

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.