views:

97

answers:

2

Does non-english characters work in google charts labels/legends ?

This works, the legends shows up fine:

var chart_url = 'http://chart.apis.google.com/chart?' + 'cht=bvs' + ...some other stuff... + '&chdl=Lowest price|Average price';

This doesn't work, the legends don't show at all:

var chart_url = 'http://chart.apis.google.com/chart?' + 'cht=bvs' + ...some other stuff... + '&chdl=L' + unescape("%E4") + 'gsta pris|Genomsnittligt pris';

Any ideas? Thanks in advance!

/toby

-----------edit-----------

Neither of these works:

'&chdl=Lägsta pris|Genomsnittligt pris'

'&chdl=L& auml;gsta pris|Genomsnittligt pris' (without the space after &)

'&chdl=L%E4gsta pris|Genomsnittligt pris'

%E4 == ä urlencoded.

+1  A: 

My guess is that most letters will work, but you have to do the equivalent of urlencoding them (see urlencode()).

Chacha102
Because you are sending it over a URL, Google wants it to be urlencoded. Have you tried just sending the URL encoded value?
Chacha102
A: 

Struggled with the same problem and it turned out that google charts want the texts urlencoded in UTF-8 (of course...)

So "Lägsta pris" should be == L%C3%A4gsta+pris

mrMoo