“Ø” as input in C#
-
14-04-2021 - |
Pregunta
I'm working on automating GUI-testing at my job. I'm currently stuck at something as silly as inserting the character "ø", which is a letter of my language.
The method-call is as follows:
_atlas.AvailabilityRadioSearch.InsertAddressAddress("kjøita");
This is supposed to automatically fill in the value in a standard textbox on the webpage. But, I can't seem to get it right. It always turns out "kj?ita".
Does anybody know how I can go about fixing this?
Oh, and btw;
Please do not care about the crappy method- and classnames, as this is just for testing-purposes and not to be used by anyone else :)
Solución
You need to change 'ø' into ø
Otros consejos
Think about setting the UI Culture/Culture on your page:
web.config
<configuration>
<system.web>
<globalizationculture="FR-CH" uiCulture="FR-CH" />
</system.web>
</configuration>
Page
<%@Page Culture="FR-CH" uiCulture="FR-CH" Language="C#" %>
Replace FR-CH with your specific language culture and you should be good to go.
MSDN UI Culture/Culture for ASP.NET
Just tested this and it works, despite being clunky:
char oSlash = '\u00F8'; //use '\u00D8' for the uppercase version
_atlas.AvailabilityRadioSearch.InsertAddressAddress("kj" + oSlash + "ita");