is there a setlocale in .net?

im used to do this on coldfusion.
i could set the locale settings for the application.

im having problems with my application if i set the locale setting of windows to a different language
(control panel\Regional Settings\Regional Option)

different kinds errors shows up.
i figured if i could just set the application to use US only locale and not to use windows locale
 then my application is good to go.. i guess..

ideas?

if i set Regional option to Sami,southern(norway). my application wont run.
If i set to chinese(hongkong), lots of unexpected behaviors are happening.
Im not even using any date,currencies,time functions.

LVL 9
Jerry_PangAsked:
Who is Participating?
 
mmarinovConnect With a Mentor Commented:
Jerry_Pang,

do you use windows or web application ?
if you use windows application, before start a new thread and on start of the application write

System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

B..M
0
 
mmarinovCommented:
Hi Jerry_Pang,

you have to set the current thread to use new CultureInfo("en-US")

Regards!
B..M
0
 
Jerry_PangAuthor Commented:
help. could you show me some examples how?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Jerry_PangAuthor Commented:
i found the main cause.

its on the web application not on my windows application code.

=). how to set on web application?
0
 
mmarinovCommented:
Jerry_Pang,

the you have to set the culture info as i posted before in every page

B..M
0
 
Jerry_PangAuthor Commented:
yes i have. no probs with my application.

it was somewhere within the html>activex>html.
its not on any of my code.

i think the problem was html encoding or something.

will try to use html charset.
is there a processing directive?

anyways, i have found the root cause already, will try different approaches to fix the problem.
0
 
Jerry_PangAuthor Commented:
hm..

control panel\regional and language settings\regional option
Set to Chinese Hongkong (install east asian language)

if i submit ñ or other chinese characters, the next page wont display.
we submit these characters to activx for processing.

this works if Language is set to EN-US but not if chinese or other characters.

any ideas?

the question is already answered. will increase points for set locale in web.
another points for any ideas, suggestions what to do next.

thanx
0
 
mmarinovConnect With a Mentor Commented:
i'm not sure how these characters are send through or to the activex so may be the process stops because they means something special
can you try to output some information when the activex sees characters like this

also the current culture depends on the first language set in the (example for IE ) Tools->Internet Options->Languages->Languages Preference

also, so may be the activex gets this language and try to work based on it

B..M
0
 
CJ_SConnect With a Mentor Commented:
Copy pasted from my answer the other day

---------

I suggest you to look a the CultureInfo class provided by the .Net framework whcih is used by the HttpContext.CurrentCulture and CurrentUICulture. By setting the correct culture you can change the way datetime objects are shown on the screen and how they are used within your system. The easiest way would be by setting the correct property in the web.config.

For example:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="nl-NL" uiCulture="nl-NL" />
 </system.web>
</configuration>

Look at the properties culture and uiCulture.

However, when you are talking with a database you might have to always work with american date format (mm-dd-yyyy).

CJ.
0
 
Jerry_PangAuthor Commented:
5
0
 
etmendzConnect With a Mentor Commented:
It seems that the remaining issue is in your ActiveX.

Is it designed to support non-English characters/settings?
Did you create this ActiveX? What language?
What does the ActiveX do?
Does it process text? Dates? Numbers?
Does it connect to the database? What database?
Does it call stored procedures?
Does it execute dynamic queries?

Maybe if you can give more information about the ActiveX we can help you more...
0
 
Jerry_PangAuthor Commented:
oop.s o thought i have close the question already..

anyways,

Did you create this ActiveX? What language?
i did not create this activex, i dont know.

What does the ActiveX do?
i have no idea, we just send some xml and the other IE page will show/display err.. sumthing.

Does it process text? Dates? Numbers?
hmmm.. i dont think so, we just send some xml data and let it process. it think it has something to do with double byte characters. it occurs with chinese/japanese/korean language i think.

Does it connect to the database? What database?
no it wont anymore. i handle the database connection, they think its my bug. i found the root cause, its on the web, somewhere on xml parsing i think.

Does it call stored procedures?
nope.

Does it execute dynamic queries?
nope..

it only parses the XMLdata.

sample xml that it wont accept is
<title>
Español - Wont accept ñ
Some chinese characters -wont display properly
</title>

i was thinking of converting it to &#u00?? but it wont accept & either.

0
 
Jerry_PangAuthor Commented:
>Does it process text? Dates? Numbers?
>hmmm.. i dont think so, we just send some xml data and let it process. it think it has something to do with double byte >characters. it occurs with chinese/japanese/korean language i think.

it works perfectly if the regional settings is english US
it wont work if the regional settings is set to Chinese (Hongkong)

if OS language is set to English, everything is OK. it will accept any unicode characters.
If OS language is set to Chinese, bugs everywhere.
0
 
mmarinovCommented:
because of no way escaping of this ( it is client maching properties ) i suggest you in your application what is the cultureinfo and if it is not en-US then redirect to an error page, that tells the user to change the browser language to en-US or he/she will can not be able to work with the site

B..M
0
 
etmendzCommented:
Then maybe it is simply safe to conclude that the ActiveX does not support non-English characters and should be replaced with something else that can support non-English characters. Most ActiveX are independent on the HTML and browser settings though they tend to use the machine's settings.

Have fun.
0
 
Jerry_PangAuthor Commented:
hello mmarinov.
the html is just a plane html page.
its not an aspx page.

my application
generates an XML ---> to be submited to HTML page ---> opens activex and recieves the Activex  ---> to a different browser

Somewhere i think their html to activex or from activex to a different browser is the problem.

We are doing a different test now. hopefully we could solve this problem.

im planning to convert al the unicode characters into &#u00??? equivalent. from the test it doesnt accept '&' either.

thanx anyways for all your help. i will be closing this question now.
0
 
Jerry_PangAuthor Commented:
solve.

We created an activex test to accept xml, output the text if it is still ok.
after the activex process, output it again and test the result if its still ok.

I found the solution.
i converted the non ascii characters to &#unicode; equivalent and now its working ok..

now i will have to make some major changes in my application again to accept &#unicode; instead of the actual characters. thanx
0
 
Jerry_PangAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.