Globalization not working as intended when using da-DK

Discussion in 'ASP .Net' started by Basildk, Aug 30, 2007.

  1. Basildk

    Basildk Guest

    Hi.

    I have a strange problem. We have an asp.net application running on
    several server with different setups.
    On 2 of our servers we experience that the globalization settings are
    misbehaving.

    We have boiled the problem down to this: (exemplified by a very simple
    page)

    protected void Page_Load(object sender, EventArgs e)
    {
    Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    "<br />");
    Response.Write(DateTime.Now.ToString() + "<br />");
    }

    Output is the following:
    da-DK
    $2.00
    8/30/2007 5:14:02 PM

    Since currentCulture is "da-DK" i would have expected the something
    like the following:
    kr 2.00
    30-08-2007
    This is in fact the result coming from the servers that are working.

    How come the Culture is not formatting the values correctly?

    Thanks for the help..
     
    Basildk, Aug 30, 2007
    #1
    1. Advertising

  2. Basildk

    Patrice Guest

    What if you display CurrentUICulture ?

    ---
    Patrice

    "Basildk" <> a écrit dans le message de news:
    ...
    > Hi.
    >
    > I have a strange problem. We have an asp.net application running on
    > several server with different setups.
    > On 2 of our servers we experience that the globalization settings are
    > misbehaving.
    >
    > We have boiled the problem down to this: (exemplified by a very simple
    > page)
    >
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > "<br />");
    > Response.Write(DateTime.Now.ToString() + "<br />");
    > }
    >
    > Output is the following:
    > da-DK
    > $2.00
    > 8/30/2007 5:14:02 PM
    >
    > Since currentCulture is "da-DK" i would have expected the something
    > like the following:
    > kr 2.00
    > 30-08-2007
    > This is in fact the result coming from the servers that are working.
    >
    > How come the Culture is not formatting the values correctly?
    >
    > Thanks for the help..
    >
     
    Patrice, Aug 30, 2007
    #2
    1. Advertising

  3. Basildk

    Basildk Guest

    On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:
    > What if you display CurrentUICulture ?
    >
    > ---
    > Patrice
    >
    > "Basildk" <> a écrit dans le message de news:
    > ...
    >
    > > Hi.

    >
    > > I have a strange problem. We have an asp.net application running on
    > > several server with different setups.
    > > On 2 of our servers we experience that the globalization settings are
    > > misbehaving.

    >
    > > We have boiled the problem down to this: (exemplified by a very simple
    > > page)

    >
    > > protected void Page_Load(object sender, EventArgs e)
    > > {
    > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > "<br />");
    > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > }

    >
    > > Output is the following:
    > > da-DK
    > > $2.00
    > > 8/30/2007 5:14:02 PM

    >
    > > Since currentCulture is "da-DK" i would have expected the something
    > > like the following:
    > > kr 2.00
    > > 30-08-2007
    > > This is in fact the result coming from the servers that are working.

    >
    > > How come the Culture is not formatting the values correctly?

    >
    > > Thanks for the help..


    That displays en-US, but as far as i know, that does not affect
    formatting?
     
    Basildk, Aug 30, 2007
    #3
  4. Basildk

    Basildk Guest

    On 30 Aug., 17:48, Basildk <> wrote:
    > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:
    >
    >
    >
    > > What if you display CurrentUICulture ?

    >
    > > ---
    > > Patrice

    >
    > > "Basildk" <> a écrit dans le message de news:
    > > ...

    >
    > > > Hi.

    >
    > > > I have a strange problem. We have an asp.net application running on
    > > > several server with different setups.
    > > > On 2 of our servers we experience that the globalization settings are
    > > > misbehaving.

    >
    > > > We have boiled the problem down to this: (exemplified by a very simple
    > > > page)

    >
    > > > protected void Page_Load(object sender, EventArgs e)
    > > > {
    > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > > "<br />");
    > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > }

    >
    > > > Output is the following:
    > > > da-DK
    > > > $2.00
    > > > 8/30/2007 5:14:02 PM

    >
    > > > Since currentCulture is "da-DK" i would have expected the something
    > > > like the following:
    > > > kr 2.00
    > > > 30-08-2007
    > > > This is in fact the result coming from the servers that are working.

    >
    > > > How come the Culture is not formatting the values correctly?

    >
    > > > Thanks for the help..

    >
    > That displays en-US, but as far as i know, that does not affect
    > formatting?


    I just tried setting CurrentUICulture to "da-DK", but with the same
    result..
     
    Basildk, Aug 30, 2007
    #4
  5. Basildk

    Basildk Guest

    On 30 Aug., 17:51, Basildk <> wrote:
    > On 30 Aug., 17:48, Basildk <> wrote:
    >
    >
    >
    > > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:

    >
    > > > What if you display CurrentUICulture ?

    >
    > > > ---
    > > > Patrice

    >
    > > > "Basildk" <> a écrit dans le message de news:
    > > > ...

    >
    > > > > Hi.

    >
    > > > > I have a strange problem. We have an asp.net application running on
    > > > > several server with different setups.
    > > > > On 2 of our servers we experience that the globalization settings are
    > > > > misbehaving.

    >
    > > > > We have boiled the problem down to this: (exemplified by a very simple
    > > > > page)

    >
    > > > > protected void Page_Load(object sender, EventArgs e)
    > > > > {
    > > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > > > "<br />");
    > > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > > }

    >
    > > > > Output is the following:
    > > > > da-DK
    > > > > $2.00
    > > > > 8/30/2007 5:14:02 PM

    >
    > > > > Since currentCulture is "da-DK" i would have expected the something
    > > > > like the following:
    > > > > kr 2.00
    > > > > 30-08-2007
    > > > > This is in fact the result coming from the servers that are working.

    >
    > > > > How come the Culture is not formatting the values correctly?

    >
    > > > > Thanks for the help..

    >
    > > That displays en-US, but as far as i know, that does not affect
    > > formatting?

    >
    > I just tried setting CurrentUICulture to "da-DK", but with the same
    > result..


    I researched a little further:
    If i insert the following code:
    Response.Write("Language " + cultureInfo.Name + "<br />");
    Response.Write("---------------------------------<br />");
    Response.Write("CurrencySymbol " +
    cultureInfo.NumberFormat.CurrencySymbol.ToString() + "<br />");
    Response.Write("DateSeparator " +
    cultureInfo.DateTimeFormat.DateSeparator + "<br />");
    Response.Write("LongDatePattern " +
    cultureInfo.DateTimeFormat.LongDatePattern.ToString() + "<br />");
    Response.Write("ShortDatePattern " +
    cultureInfo.DateTimeFormat.ShortDatePattern.ToString() + "<br />");
    string[] days = cultureInfo.DateTimeFormat.DayNames;
    for( int i = 0; i < days.Length; i++)
    {
    Response.Write(days + "<br />");
    }
    Response.Write("---------------------------------<br />");


    I get the following output:

    Language da-DK
    ---------------------------------
    CurrencySymbol $
    DateSeparator /
    LongDatePattern dddd, MMMM dd, yyyy
    ShortDatePattern M/d/yyyy
    søndag
    mandag
    tirsdag
    onsdag
    torsdag
    fredag
    lørdag

    In other words: Some of the values are perfect danish (the days) while
    others are stille american (datepattern, dateseperator and
    currencySymbol)
    I am puzzled:)
     
    Basildk, Aug 30, 2007
    #5
  6. See if this sample code helps...

    cultureChange.aspx:
    -----------------------------
    <%@ Page Language="VB" uiculture="auto" %>
    <%@ Import Namespace="System.Threading" %>
    <%@ Import Namespace="System.Globalization" %>

    <script runat="server">
    Protected Overrides Sub InitializeCulture()
    If Request.Form("ListBox1") IsNot Nothing Then
    Dim selectedLanguage As String = Request.Form("ListBox1")
    UICulture = Request.Form("ListBox1")
    Culture = Request.Form("ListBox1")
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
    Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
    End If
    MyBase.InitializeCulture()
    End Sub
    Sub Page_Load(obj as object, e as eventargs)
    Dim value as Double = 2.0
    Dim s as String 'create a string and format it as currency.
    s = String.Format("{0:c}", value)
    lblMessage.Text = Listbox1.SelectedItem.Text
    lblMessage2.Text = Listbox1.SelectedItem.Value & " " & DateTime.Now & " " & s

    End Sub
    </script>
    <html>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ListBox ID="ListBox1" runat="server">
    <asp:ListItem Value="en-US" Selected="True">English</asp:ListItem>
    <asp:ListItem Value="es-MX">Español</asp:ListItem>
    <asp:ListItem Value="da-DK">Danish</asp:ListItem>
    </asp:ListBox><br />
    <asp:Button ID="Button1" runat="server"
    Text="Set Language/Culture"
    meta:resourcekey="Button1" />
    <br />
    <asp:Label ID="Label1" runat="server"
    Text=""
    meta:resourcekey="Label1" />
    </div>
    <div>
    <asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
    <asp:Label id="lblMessage2" runat="server"/></asp:Label> <br />
    </div>

    </form>
    </body>
    </html>
    ----------

    That code changes the culture/language on demand...

    If you select Danish and click the Button, you'll see kr displayed, and the Danish time format,
    but if you select English, you'll see $ displayed and the US time format.

    You should be able to adapt it for your purposes.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Basildk" <> wrote in message news:...
    On 30 Aug., 17:48, Basildk <> wrote:
    > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:
    >
    >
    >
    > > What if you display CurrentUICulture ?

    >
    > > ---
    > > Patrice

    >
    > > "Basildk" <> a écrit dans le message de news:
    > > ...

    >
    > > > Hi.

    >
    > > > I have a strange problem. We have an asp.net application running on
    > > > several server with different setups.
    > > > On 2 of our servers we experience that the globalization settings are
    > > > misbehaving.

    >
    > > > We have boiled the problem down to this: (exemplified by a very simple
    > > > page)

    >
    > > > protected void Page_Load(object sender, EventArgs e)
    > > > {
    > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > > "<br />");
    > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > }

    >
    > > > Output is the following:
    > > > da-DK
    > > > $2.00
    > > > 8/30/2007 5:14:02 PM

    >
    > > > Since currentCulture is "da-DK" i would have expected the something
    > > > like the following:
    > > > kr 2.00
    > > > 30-08-2007
    > > > This is in fact the result coming from the servers that are working.

    >
    > > > How come the Culture is not formatting the values correctly?

    >
    > > > Thanks for the help..

    >
    > That displays en-US, but as far as i know, that does not affect
    > formatting?


    I just tried setting CurrentUICulture to "da-DK", but with the same
    result..
     
    Juan T. Llibre, Aug 30, 2007
    #6
  7. Basildk

    Basildk Guest

    On 30 Aug., 18:21, "Juan T. Llibre" <> wrote:
    > See if this sample code helps...
    >
    > cultureChange.aspx:
    > -----------------------------
    > <%@ Page Language="VB" uiculture="auto" %>
    > <%@ Import Namespace="System.Threading" %>
    > <%@ Import Namespace="System.Globalization" %>
    >
    > <script runat="server">
    > Protected Overrides Sub InitializeCulture()
    > If Request.Form("ListBox1") IsNot Nothing Then
    > Dim selectedLanguage As String = Request.Form("ListBox1")
    > UICulture = Request.Form("ListBox1")
    > Culture = Request.Form("ListBox1")
    > Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
    > Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
    > End If
    > MyBase.InitializeCulture()
    > End Sub
    > Sub Page_Load(obj as object, e as eventargs)
    > Dim value as Double = 2.0
    > Dim s as String 'create a string and format it as currency.
    > s = String.Format("{0:c}", value)
    > lblMessage.Text = Listbox1.SelectedItem.Text
    > lblMessage2.Text = Listbox1.SelectedItem.Value & " " & DateTime.Now & " " & s
    >
    > End Sub
    > </script>
    > <html>
    > <body>
    > <form id="form1" runat="server">
    > <div>
    > <asp:ListBox ID="ListBox1" runat="server">
    > <asp:ListItem Value="en-US" Selected="True">English</asp:ListItem>
    > <asp:ListItem Value="es-MX">Español</asp:ListItem>
    > <asp:ListItem Value="da-DK">Danish</asp:ListItem>
    > </asp:ListBox><br />
    > <asp:Button ID="Button1" runat="server"
    > Text="Set Language/Culture"
    > meta:resourcekey="Button1" />
    > <br />
    > <asp:Label ID="Label1" runat="server"
    > Text=""
    > meta:resourcekey="Label1" />
    > </div>
    > <div>
    > <asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
    > <asp:Label id="lblMessage2" runat="server"/></asp:Label> <br />
    > </div>
    >
    > </form>
    > </body>
    > </html>
    > ----------
    >
    > That code changes the culture/language on demand...
    >
    > If you select Danish and click the Button, you'll see kr displayed, and the Danish time format,
    > but if you select English, you'll see $ displayed and the US time format.
    >
    > You should be able to adapt it for your purposes.
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq :http://asp.net.do/faq/
    > foros de asp.net, en español :http://asp.net.do/foros/
    > ======================================"Basildk" <> wrote in messagenews:...
    >
    > On 30 Aug., 17:48, Basildk <> wrote:
    >
    >
    >
    > > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:

    >
    > > > What if you display CurrentUICulture ?

    >
    > > > ---
    > > > Patrice

    >
    > > > "Basildk" <> a écrit dans le message de news:
    > > > ...

    >
    > > > > Hi.

    >
    > > > > I have a strange problem. We have an asp.net application running on
    > > > > several server with different setups.
    > > > > On 2 of our servers we experience that the globalization settings are
    > > > > misbehaving.

    >
    > > > > We have boiled the problem down to this: (exemplified by a very simple
    > > > > page)

    >
    > > > > protected void Page_Load(object sender, EventArgs e)
    > > > > {
    > > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > > > "<br />");
    > > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > > }

    >
    > > > > Output is the following:
    > > > > da-DK
    > > > > $2.00
    > > > > 8/30/2007 5:14:02 PM

    >
    > > > > Since currentCulture is "da-DK" i would have expected the something
    > > > > like the following:
    > > > > kr 2.00
    > > > > 30-08-2007
    > > > > This is in fact the result coming from the servers that are working.

    >
    > > > > How come the Culture is not formatting the values correctly?

    >
    > > > > Thanks for the help..

    >
    > > That displays en-US, but as far as i know, that does not affect
    > > formatting?

    >
    > I just tried setting CurrentUICulture to "da-DK", but with the same
    > result..


    Thanks for the reply. I tried you code, but with the feared result:

    Danish
    da-DK 8/30/2007 6:32:32 PM $2.00
     
    Basildk, Aug 30, 2007
    #7
  8. re:
    !> Thanks for the reply. I tried you code, but with the feared result:

    I don't have a clue why it would work at my server and not on yours.

    See the online sample at :

    http://asp.net.do/test/culture3.aspx

    Are you formatting the string as currency, per the sample ?

    !> Dim value as Double = 2.0
    !> Dim s as String 'create a string and format it as currency.
    !> s = String.Format("{0:c}", value)

    If you don't format the string as currency, no currency symbol change can occur.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Basildk" <> wrote in message news:...
    On 30 Aug., 18:21, "Juan T. Llibre" <> wrote:
    > See if this sample code helps...
    >
    > cultureChange.aspx:
    > -----------------------------
    > <%@ Page Language="VB" uiculture="auto" %>
    > <%@ Import Namespace="System.Threading" %>
    > <%@ Import Namespace="System.Globalization" %>
    >
    > <script runat="server">
    > Protected Overrides Sub InitializeCulture()
    > If Request.Form("ListBox1") IsNot Nothing Then
    > Dim selectedLanguage As String = Request.Form("ListBox1")
    > UICulture = Request.Form("ListBox1")
    > Culture = Request.Form("ListBox1")
    > Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
    > Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
    > End If
    > MyBase.InitializeCulture()
    > End Sub
    > Sub Page_Load(obj as object, e as eventargs)
    > Dim value as Double = 2.0
    > Dim s as String 'create a string and format it as currency.
    > s = String.Format("{0:c}", value)
    > lblMessage.Text = Listbox1.SelectedItem.Text
    > lblMessage2.Text = Listbox1.SelectedItem.Value & " " & DateTime.Now & " " & s
    >
    > End Sub
    > </script>
    > <html>
    > <body>
    > <form id="form1" runat="server">
    > <div>
    > <asp:ListBox ID="ListBox1" runat="server">
    > <asp:ListItem Value="en-US" Selected="True">English</asp:ListItem>
    > <asp:ListItem Value="es-MX">Español</asp:ListItem>
    > <asp:ListItem Value="da-DK">Danish</asp:ListItem>
    > </asp:ListBox><br />
    > <asp:Button ID="Button1" runat="server"
    > Text="Set Language/Culture"
    > meta:resourcekey="Button1" />
    > <br />
    > <asp:Label ID="Label1" runat="server"
    > Text=""
    > meta:resourcekey="Label1" />
    > </div>
    > <div>
    > <asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
    > <asp:Label id="lblMessage2" runat="server"/></asp:Label> <br />
    > </div>
    >
    > </form>
    > </body>
    > </html>
    > ----------
    >
    > That code changes the culture/language on demand...
    >
    > If you select Danish and click the Button, you'll see kr displayed, and the Danish time format,
    > but if you select English, you'll see $ displayed and the US time format.
    >
    > You should be able to adapt it for your purposes.
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq :http://asp.net.do/faq/
    > foros de asp.net, en español :http://asp.net.do/foros/
    > ======================================"Basildk" <> wrote in
    > messagenews:...
    >
    > On 30 Aug., 17:48, Basildk <> wrote:
    >
    >
    >
    > > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:

    >
    > > > What if you display CurrentUICulture ?

    >
    > > > ---
    > > > Patrice

    >
    > > > "Basildk" <> a écrit dans le message de news:
    > > > ...

    >
    > > > > Hi.

    >
    > > > > I have a strange problem. We have an asp.net application running on
    > > > > several server with different setups.
    > > > > On 2 of our servers we experience that the globalization settings are
    > > > > misbehaving.

    >
    > > > > We have boiled the problem down to this: (exemplified by a very simple
    > > > > page)

    >
    > > > > protected void Page_Load(object sender, EventArgs e)
    > > > > {
    > > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture) +
    > > > > "<br />");
    > > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > > }

    >
    > > > > Output is the following:
    > > > > da-DK
    > > > > $2.00
    > > > > 8/30/2007 5:14:02 PM

    >
    > > > > Since currentCulture is "da-DK" i would have expected the something
    > > > > like the following:
    > > > > kr 2.00
    > > > > 30-08-2007
    > > > > This is in fact the result coming from the servers that are working.

    >
    > > > > How come the Culture is not formatting the values correctly?

    >
    > > > > Thanks for the help..

    >
    > > That displays en-US, but as far as i know, that does not affect
    > > formatting?

    >
    > I just tried setting CurrentUICulture to "da-DK", but with the same
    > result..


    Thanks for the reply. I tried you code, but with the feared result:

    Danish
    da-DK 8/30/2007 6:32:32 PM $2.00
     
    Juan T. Llibre, Aug 30, 2007
    #8
  9. Basildk

    Patrice Guest

    Yeah just random thoughts & tries for now...

    What if you try a *Windows* .NET based application on the server that you'll
    run under a regular account. Do you have the same result ? In case it would
    work what if you make your ASP.NET application run under the same account ?

    I'm not sure how .NET get these info (my understanding at least for 2.0
    would be that they are build right into the framework ??). If the FW uses
    system files to get those info then it could be a system level problem with
    nls support files and I belive I saw once this in classic ASP and it was a
    profile related issue...

    --
    Good luck, sorry for the poor help


    "Basildk" <> a écrit dans le message de news:
    ...
    On 30 Aug., 17:51, Basildk <> wrote:
    > On 30 Aug., 17:48, Basildk <> wrote:
    >
    >
    >
    > > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:

    >
    > > > What if you display CurrentUICulture ?

    >
    > > > ---
    > > > Patrice

    >
    > > > "Basildk" <> a écrit dans le message de news:
    > > > ...

    >
    > > > > Hi.

    >
    > > > > I have a strange problem. We have an asp.net application running on
    > > > > several server with different setups.
    > > > > On 2 of our servers we experience that the globalization settings
    > > > > are
    > > > > misbehaving.

    >
    > > > > We have boiled the problem down to this: (exemplified by a very
    > > > > simple
    > > > > page)

    >
    > > > > protected void Page_Load(object sender, EventArgs e)
    > > > > {
    > > > > Response.Write(Thread.CurrentThread.CurrentCulture.Name + "<br />");
    > > > > Response.Write(2.ToString("c", Thread.CurrentThread.CurrentCulture)
    > > > > +
    > > > > "<br />");
    > > > > Response.Write(DateTime.Now.ToString() + "<br />");
    > > > > }

    >
    > > > > Output is the following:
    > > > > da-DK
    > > > > $2.00
    > > > > 8/30/2007 5:14:02 PM

    >
    > > > > Since currentCulture is "da-DK" i would have expected the something
    > > > > like the following:
    > > > > kr 2.00
    > > > > 30-08-2007
    > > > > This is in fact the result coming from the servers that are working.

    >
    > > > > How come the Culture is not formatting the values correctly?

    >
    > > > > Thanks for the help..

    >
    > > That displays en-US, but as far as i know, that does not affect
    > > formatting?

    >
    > I just tried setting CurrentUICulture to "da-DK", but with the same
    > result..


    I researched a little further:
    If i insert the following code:
    Response.Write("Language " + cultureInfo.Name + "<br />");
    Response.Write("---------------------------------<br />");
    Response.Write("CurrencySymbol " +
    cultureInfo.NumberFormat.CurrencySymbol.ToString() + "<br />");
    Response.Write("DateSeparator " +
    cultureInfo.DateTimeFormat.DateSeparator + "<br />");
    Response.Write("LongDatePattern " +
    cultureInfo.DateTimeFormat.LongDatePattern.ToString() + "<br />");
    Response.Write("ShortDatePattern " +
    cultureInfo.DateTimeFormat.ShortDatePattern.ToString() + "<br />");
    string[] days = cultureInfo.DateTimeFormat.DayNames;
    for( int i = 0; i < days.Length; i++)
    {
    Response.Write(days + "<br />");
    }
    Response.Write("---------------------------------<br />");


    I get the following output:

    Language da-DK
    ---------------------------------
    CurrencySymbol $
    DateSeparator /
    LongDatePattern dddd, MMMM dd, yyyy
    ShortDatePattern M/d/yyyy
    søndag
    mandag
    tirsdag
    onsdag
    torsdag
    fredag
    lørdag

    In other words: Some of the values are perfect danish (the days) while
    others are stille american (datepattern, dateseperator and
    currencySymbol)
    I am puzzled:)
     
    Patrice, Aug 31, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oney
    Replies:
    0
    Views:
    297
  2. Martin Maney
    Replies:
    1
    Views:
    307
    Gabriel Genellina
    Apr 11, 2007
  3. epsilon
    Replies:
    2
    Views:
    222
  4. Mike
    Replies:
    4
    Views:
    217
  5. chaitu
    Replies:
    2
    Views:
    160
    chaitu
    Sep 21, 2006
Loading...

Share This Page