Skip to main content
Inspiring
August 17, 2008
Beantwortet

uCase / lCase functions and coldfusion locale

  • August 17, 2008
  • 2 Antworten
  • 1565 Ansichten
Hi,
I want to use uCase / lCase functions according to Turkish locale. These functions doesn't accept locale argument like java counterpart so i used SetLocale function but it didn't work. uCase and lCase function still make the conversion according to English language.

Turkish language has a unique characteristic. Unlike other languages:
i -uppercase-> İ (not I)
I -lowercase-> ı (not i)
as you can see, there are 4 possibilities in Turkish. ı I i İ

I am trying to convert ı i s ş to uppercase. It must be I İ S Ş but coldfusion returns I I S Ş. What am i doing wrong?

Thanks


    Dieses Thema wurde für Antworten geschlossen.
    Beste Antwort von Newsgroup_User
    bilgehan wrote:
    > Language Code of Locale - Lower Case - Upper Case - Description
    > tr (Turkish) - \u0069 - \u0130 - small letter i -> capital letter I with dot
    > above
    > tr (Turkish) - \u0131 - \u0049 - small letter dotless i -> capital letter I

    ah yes, i didn't look at the methods details. in that case, yup i had the wrong
    codepoints & yup you have to use the locale method. this produces what you want:

    <cfscript>
    tr=createObject("java","java.util.Locale").init("tr","TR");
    s="#chr(105)##chr(305)#";
    ss=s.toUppercase(tr);
    writeoutput("#s# ===> #ss#");
    </cfscript>

    > list uCase and lCase among tags for globalizing. I think CF engineers didn't
    > think about that.

    i'll bring this to the cf's team attention, in the meantime i guess wrap that
    snippet into a function (or two if you need to lower case stuff).

    2 Antworten

    Inspiring
    August 17, 2008
    bilgehan wrote:

    actually after copy/pasting those chars i get the following which appears to be
    correct:

    ıisş ===> IİSŞ

    this is cf8.
    Inspiring
    August 17, 2008
    I think news reader doesn't support utf-8 and that's why you could't see Turkish characters. I uploaded a sample test page at http://netiket.com.tr/localetest.cfm. The test page also has an image that explains the problem.

    Also i am using coldfusion server with -Duser.language=en option since it doesn't start on Turkish locale. Because of that, changing jvm locale is not an option for me. I also use cf8.
    Inspiring
    August 17, 2008
    bilgehan wrote:

    > I am trying to convert ? i s ? to uppercase. It must be I ? S ? but coldfusion
    > returns I I S ?. What am i doing wrong?

    what are the codepoint values for those chars?

    have you tried simply using the core java equivalents?

    s="turkish dotted i";
    sS=s.toUpperCase();

    while the toUpperCase() & toLowerCase() methods take a core java locale, doesn't
    seem to make a difference in my tests (but i might have the wrong codepoints).

    tr_TR locale gives everybody a headache, most java apps won't even start with
    the default locale as tr_TR. this will probably take some special case handling
    or another java lib (like maybe icu4j).