Swedish Characters in Regular expression

How do I make my Regexp to show swedish characters as they are meant: öåä
They currently get returned as a ¿
If I get a match for example Gött then will be displayed as G¿tt

My code is below
Match LocalT = Regex.Match(result, "<h1><span property=\"item\">(?<LocalT>.*?)</span>");

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Smyken,
Your code works for me (see below).  What I think is happening is when you read in the string result, you are using a StreamReader which is reading the Encoding of the document wrong.  Try to set the encoding to UTF8 manually.

Hope this helps.
//This works:
string result = @"<h1><span property=""item"">öåä</span>";
Match LocalT = Regex.Match(result, "<h1><span property=\"item\">(?<LocalT>.*?)</span>");

//Try this for reading the string:
string result = "";
            using (StreamReader srInput = new StreamReader(strInputPath, Encoding.UTF8))
                result =  srInput.ReadToEnd();

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.