Copy link to clipboard
Copied
Does the CFImage tag support Cyrillic, Japanese, and other characters using the ImageDrawText function? I have been unable to get anything but gibberish to be overlaid onto graphics when using the ImageDrawText function with a string containing international characters.
You guys outside the United States, what's the secret?
Dave
I think you should save your cf-page in utf-8 encoding and enter code inside the tag cfprocessingdirective (see description), like this:
<cfprocessingdirective pageencoding="utf-8">
<cfscript>
myimage = imageNew("", 200,50);
imageSetDrawingColor(myimage, "red");
imageDrawText(myimage, "Привет = Hello!", 30,30);
</cfscript>
<cfimage source="#myimage#" action="writeToBrowser" >
</cfprocessingdirective>
Copy link to clipboard
Copied
Yes, this function works fine with Cyrillic.
Look:
<cfscript>
myimage = imageNew("", 200,50);
imageSetDrawingColor(myimage, "red");
imageDrawText(myimage, "Привет = Hello!", 30,30);
</cfscript>
<cfimage source="#myimage#" action="writeToBrowser" >
And result:
Copy link to clipboard
Copied
Mine does not generate the same output as yours. I copied your exact source code, but mine generated this:
Is there a global setting somewhere that determines what character set is used for the graphics generation or something?
Dave
Copy link to clipboard
Copied
I think you should save your cf-page in utf-8 encoding and enter code inside the tag cfprocessingdirective (see description), like this:
<cfprocessingdirective pageencoding="utf-8">
<cfscript>
myimage = imageNew("", 200,50);
imageSetDrawingColor(myimage, "red");
imageDrawText(myimage, "Привет = Hello!", 30,30);
</cfscript>
<cfimage source="#myimage#" action="writeToBrowser" >
</cfprocessingdirective>
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Wow, how interesting!
Apparently you cannot specify the ending tag if you use the PageEncoding parameter, but without the ending tag, it works perfectly to create the Russian text!
Without this directive, even data coming from a database will not be correctly rendered, so it doesn't have anything to do with how the string is stored in the page. Somehow the directive applies to everything done by the ImageDrawText function. I don't believe that is documented anywhere, it it?
Thanks!
Dave
Copy link to clipboard
Copied
OK, I was wrong about data coming from a database. It does seem to only affect literal strings.
Anyway, thanks for the help with this. The CFProcessingDirective seems to fix the problem of the string literals not being encoded correctly.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now