Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

GetProfileString doesn't support unicode format.??

Community Beginner ,
Dec 03, 2009 Dec 03, 2009

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<cfset currentPath = getCurrentTemplatePath()>
<cfset currentDirectory = getDirectoryFromPath(currentPath)>

<cfscript>

function udf_Translate(Name, Filename, Section) {
    var outText="";

    //    If user selected default language (English), bypass the translation
    if (cookie.cookie_language eq "EN")
        return Name;
    if (Filename eq "")
        Filename = "Common";
    if (Section eq "")
        Section = "Common";
       
    INI_Path = #currentDirectory# & "Language.properties";
       
    outText = GetProfileString(INI_Path, Section, Name);
    
   
  return IIf(Len(Trim(outText)) gt 0, DE(outText), DE(Name));
   
}
</cfscript>

<cfoutput>#udf_translate("Ward", "Inpatient", "")#</cfoutput>

</body>
</html>

Language.properties

[COMMON]
Ward=Phường

It output only "Ward" instead of Phường when I save this file as UFT-8. But, when I save this file as ANSI encoding, it output as Phu?ng. It's wrong. Why GetProfileString doesn't UTF-8 format? Any solutions will be appreciated.Untitl

TOPICS
Advanced techniques
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2009 Dec 03, 2009

no it doesn't support unicode. and probably not a good idea to use it for

resource bundle (RB) substitute, use real RB instead.

http://www.sustainablegis.com/unicode/resourceBundle/rb.cfm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 03, 2009 Dec 03, 2009

Thanks, it's cool. But, is there any others solution for reading unicode format in Language.properties with GetProfileString?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2009 Dec 03, 2009

no.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 03, 2009 Dec 03, 2009
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2009 Dec 04, 2009

no, i believe that's called re-inventing the wheel.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2009 Dec 04, 2009

ha ha... you can say that again. But, I can do it by myself.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2009 Dec 04, 2009

you didn't need to (that's why it's called "re-inventing the wheel"):

http://www.sustainablegis.com/blog/cfg11n/index.cfm?mode=cat&catid=6D990B76-50FC-543B-1FA4AB2B1CE26EFC

once these things get bigger & more complex, how will you manage them? notepad?

you're better off sticking w/a "main stream"/proven methodology that are based

on good practices than knocking off stuff like this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2009 Dec 04, 2009

ahh.. nope, thanks anyway. Because, we use "getprofilestring" for internationalize in our project. In our projects, there are more than 500 files. Now, our client is Vietnamense and their language is created by unicode. As you know, getprofilestring doesn't support unicode. That's why I create it above coding, and don't wanna touch all files in our projects for this language. If we use above link you show, we need to replace all files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2009 Dec 04, 2009

what you're doing is a perfect example of a bad practice. i guess that you

didn't bother researching this before you started. suit yourself.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2009 Dec 04, 2009

Sure, dude. Because, we're on rush. Thanks, anyway.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2009 Dec 04, 2009
LATEST

This exchange is quite familiar. It occurs daily at our own neck of the woods. What fun!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources