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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:59:51+00:00 2026-06-17T18:59:51+00:00

An ASP.NET page (ashx) receives a GET request with a UTF8 string. It reads

  • 0

An ASP.NET page (ashx) receives a GET request with a UTF8 string. It reads a SqlServer database with Windows-1255 data.

I can’t seem to get them to work together. I’ve used information gathered on SO (mainly Convert a string's character encoding from windows-1252 to utf-8) as well as msdn on the subject.

When I run anything through the functions below – it always ends up the same as it started – not converted at all.

Is something done wrong?

EDIT

What I’m specifically trying to do (getData returns a Dictionary<int, string>):

getData().Where(a => a.Value.Contains(context.Request.QueryString["q"]))

Result is empty, unless I send a “neutral” character such as “‘” or “,”.

CODE

    string windows1255FromUTF8(string p)
    {
        Encoding win = Encoding.GetEncoding(1255);
        Encoding utf8 = Encoding.UTF8;

        byte[] utfBytes = utf8.GetBytes(p);
        byte[] winBytes = Encoding.Convert(utf8, win, utfBytes);
        return win.GetString(winBytes);
    }

    string UTF8FromWindows1255(string p)
    {
        Encoding win = Encoding.GetEncoding(1255);
        Encoding utf8 = Encoding.UTF8;

        byte[] winBytes = win.GetBytes(p);
        byte[] utfBytes = Encoding.Convert(win, utf8, winBytes);
        return utf8.GetString(utfBytes);
    }
  • 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-17T18:59:53+00:00Added an answer on June 17, 2026 at 6:59 pm

    For some reason this worked:

    byte[] fromBytes = (fromEncoding.UTF8).GetBytes(myString);
    string finalString = (Encoding.GetEncoding(1255)).GetString(fromBytes);
    

    Switching encoding without the conversion…

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

Sidebar

Related Questions

I am sending data from android to a Generic handler .ashx page in asp.net
From some page I launch a GET request to some ASHX handler that streams
My ASP.NET page has following query string parameter: …?IDs=1000000012,1000000021,1000000013,1000000022&... Here IDs parameter will always
I've got a classic ASP page making an XMLHTTP request to my ASP.net (c#)
i'm trying to display an image from the database in an ASP.NET web page.
The ASP.net page I am currently working on has a drop down list that
I'm creating an asp.net page that uses the google map api. The page loads
I have an ASP.Net Page, aspx with its default form. I have a Submit
I have an asp.net page with three ajax updatepanels. in each panel there are
We have an ASP.NET page running on .NET Framework 4.0. At the moment we

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.