Jump to content
Software FX Community

Confusion with CodePage and Font.Charset and unicode strings


User (Legacy)

Recommended Posts

I have some general confusion on printing unicode strings for axis labels.

Each of our asp pages sets: Response.Charset = "utf-8"

The following is a snipet of code to setup my y axis:

objChart.Axis(AXIS_Y).Font.Name = "Verdana"

objChart.Axis(AXIS_Y).Font.Size = 8.25

objChart.Axis(AXIS_Y).Font.Bold = true

objChart.Axis(AXIS_Y).Title = strYLabel

where:

strYLabel = "Dy

Link to comment
Share on other sites

Ok. Let me see if I can explain this.

CodePage is used when converting UNICODE characters to MBCS, this is done

when you generate a client component. While the ChartFX Server Component is

UNICODE, the client is not so that it can run in Windows 9x. For this reason

this conversion needs to take place. Notice that this conversion does not

happen when you generate an image.

CharSet is used much later. After the strings are properly stored (whether

in UNICODE or MBCS) they need to be displayed using some font. You can look

at a font as really a "family" of fonts, some fonts support many different

character sets, others do not. Selecting the appropriate font is key,

otherwise, even with the strings being stored correctly, they will be

displayed incorrectly.

You need to make sure you use a font that supports the character set you are

targeting, remember most of the chart's processing is done in the server

(not in the client) so what you put in the Response.Charset will have no

effect, this will only have an effect if the chart was generating HTML text

in you page, which it does not, it generates either an image or an ActiveX

both unaffected by this setting.

The following page shows some chart tittles in Japanese:

<%

Set chart = Server.CreateObject("ChartFX.WebServer")

chart.TopFont.Name= "MS PGothic"

chart.TopFont.CharSet = 128 ' Japanesse

chart.TopFont.Size = 12

chart.CodePage = 932 ' shift-jis

chart.Title(CHART_TOPTIT) = "??????????"

%>

<%=chart.GetHtmltag(500,350)%>

This works in both ActiveX and image generation.

--

FP

Software FX

Link to comment
Share on other sites

Thank you for your quick response.  While your explanation of how the things

are used is helpful, I am not sure they help me solve my problem.

Problem 1:

When I add Chart.CodePage = 65001 to my code, the text strings for the axis

no longer print.

For example, the following code produces NO title on my chart:

objChart.CodePage = 65001

'Note arial has representations for all characters I want to print

objChart.TopFont.Name= "Arial"

'next line is commented out since i don't know what to set it to

'objChart.TopFont.CharSet = 0

objChart.TopFont.Size = 12

strTitle = "my unicode string"

objChart.Title(CHART_TOPTIT) = strTitle

Commenting out the CodePage line will show the title ok.

Note: If I generate charts as images, my unicode strings print in the chart

w/o need for the CodePage setting.

Problem 2:

Do I need to set Font.CharSet? What do I set the CharSet to (assuming

CodePage works appropriatelly)? The CharSets values provided by the sample

in your KB do not cover all the characters in my string. Our font choice,

Verdana, does indeed include theses characters, but the CharSet I want

(UTF-8) is not an option. Your samples imply that I need to know what

language the string is in to be able to print it. But our string is

comprised of characters from many languages. In asp, we are able to say the

charset is UTF-8 and the string prints fine. In addition, generating charts

as images works fine (my string is displayed correctly). Why can't I do

this with the ActiveX component?

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:NSukCbZ9DHA.196@webserver3.softwarefx.com...

> Ok. Let me see if I can explain this.

>

> CodePage is used when converting UNICODE characters to MBCS, this is done

> when you generate a client component. While the ChartFX Server Component

is

> UNICODE, the client is not so that it can run in Windows 9x. For this

reason

> this conversion needs to take place. Notice that this conversion does not

> happen when you generate an image.

>

> CharSet is used much later. After the strings are properly stored (whether

> in UNICODE or MBCS) they need to be displayed using some font. You can

look

> at a font as really a "family" of fonts, some fonts support many different

> character sets, others do not. Selecting the appropriate font is key,

> otherwise, even with the strings being stored correctly, they will be

> displayed incorrectly.

>

> You need to make sure you use a font that supports the character set you

are

> targeting, remember most of the chart's processing is done in the server

> (not in the client) so what you put in the Response.Charset will have no

> effect, this will only have an effect if the chart was generating HTML

text

> in you page, which it does not, it generates either an image or an ActiveX

> both unaffected by this setting.

>

> The following page shows some chart tittles in Japanese:

> <%

> Set chart = Server.CreateObject("ChartFX.WebServer")

> chart.TopFont.Name= "MS PGothic"

> chart.TopFont.CharSet = 128 ' Japanesse

> chart.TopFont.Size = 12

> chart.CodePage = 932 ' shift-jis

> chart.Title(CHART_TOPTIT) = "??????????"

> %>

> <%=chart.GetHtmltag(500,350)%>

>

> This works in both ActiveX and image generation.

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

I really don't know if you can achieve what you want.

The CharSet property is not ours, is a property of the OLE Font object. The

table posted in our article is from MS. I've never seen a font with UTF-8 as

a possible charset. When you go in WordPad, for example and select Arial as

your font, what options do you get for the "Script" field ? these are the

supported character sets.

Your strings contain data in MULTIPLE languages (in the same string) ?

The CodePage is used, as I mentioned before, only when you generate a Client

Component since this component is NOT a UNICODE component (in order to run

in Windows 9x). Codepage is not used when producing images.

--

FP

Software FX

Link to comment
Share on other sites

I understand that CodePage is not used when generating charts as images - I

included this to point out that the chart works fine if generation is left

entirely on the server. However, I would like to provide client components.

There must be SOME way to have active charts display my string. I have

tried many combos of codepage and charset and I can not get my string to

print correctly.

It would be unbelievable helpful if someone could provide sample code that

made a client component that could print a chart title with the string

attached (saved as utf-8).

Again, my code is this

Chart.TopFont.Name= "Verdana"

'no idea what to put here

Chart.TopFont.CharSet = ???

'thought i needed 65001 but i get nothing when i do

Chart.CodePage = ???

Chart.TopFont.Size = 12

'i get my string from xml (not shown here)

str = "my unicode string from the text file"

Chart.Title(CHART_TOPTIT) = str

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:zwbwVem9DHA.2804@webserver3.softwarefx.com...

> I really don't know if you can achieve what you want.

>

> The CharSet property is not ours, is a property of the OLE Font object.

The

> table posted in our article is from MS. I've never seen a font with UTF-8

as

> a possible charset. When you go in WordPad, for example and select Arial

as

> your font, what options do you get for the "Script" field ? these are the

> supported character sets.

>

> Your strings contain data in MULTIPLE languages (in the same string) ?

>

> The CodePage is used, as I mentioned before, only when you generate a

Client

> Component since this component is NOT a UNICODE component (in order to run

> in Windows 9x). Codepage is not used when producing images.

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

What I sent you is as close a sample as I have.

I've never done it (and don't know if it's even possible in Windows 9x)

using UTF-8, I've always done it using some SPECIFIC Char Set (such as

Japanese) , you may want to contact our support dept. so that they can work

with you on a solution for this.

--

FP

Software FX

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...