DescriptionVariety of languages sometimes causes problems when we deal with text drawing. Everything may work ok, until you try to draw a string which contains non-english symbols, especially such complex characters as Japanise, Arabic, Chinese and so on. For example you write an application in ASP and try to draw such characters you can receive the following:

instead of:
ReasonASP file has incorrect encoding. That's why wrong symbols are passed to the Graphics Processor and it cannot draw it correctly.
SolutionTo make Graphics Processor draw such symbols correctly, you should set right encoding to the file which contains the script.
Let's assume that we have draw text via the following code:
Code:<%
Option Explicit
' Create RasterObject
Dim objRaster
Set objRaster = Server.CreateObject("GraphicsProcessor2002.RasterObject")
objRaster.EmptyImage 200, 50
' Create DrawingTool
Dim objDT
Set objDT = Server.CreateObject("GraphicsProcessor2002.DrawingTool")
objDT.AntialiasingOn = True
' Adjust font settings
objDT.DefaultTextInfo.FontSize = 18
objDT.DefaultTextInfo.IsBold = False
objDT.DefaultTextInfo.IsItalic = True
Dim strText, dblTextWidth, dblTextHeight
strText = "Text..."
' Draw it on the RasterObject
objDT.RasterObject = objRaster
objDT.SetText strText,0,0
' Save it to browser
objRaster.EncoderOptions("OutputFileType") = "GIF"
objRaster.SaveStream Response
objRaster.SaveFile Server.MapPath("measure.gif")
Set objRaster = Nothing
%>
Replace strText variable value into some text on necessary language, something like this:

As the file contains non-English characters, we should specify the text encoding in order it could be read correctly. For example we could use
UTF-8 (
UTF-16 is not supported in ASP). To use UTF-8 you should do two things:
1. Specify in the beginning of ASP page that you are going to use this encoding. To do it, just insert the following string in the beginning of the ASP page:
Code:<% CodePage=65001 %>
2. Save ASP file using
UTF-8 encoding. Note, you should select
UTF-8 encoding
with signature. If you work in Visual Studio .NET you can specify the encoding in the following way:

and then

After that you can save file as usual, it will be saved using right encoding.
You can also open encoding options dialog directly from Save dialog:

If you edit the file in
Notepad, you can just select
UTF-8 encoding in
Save dialog:

Best regards,
Fedor Skvortsov