What's the character set in your browser?

On Tuesday, March 27, 2012 9:13:14 AM UTC-7, miguel wrote:
>
> This is not strictly a web2py issue. Though it is a problem that apps 
> dealing with some character sets must deal with.
> I confess that the source of my problem is that I have been delaying 
> reading-up on encoding and decoding far too long. But I'm pressed for time 
> and I'm sure that this is a simple issue to many of you.
>
> Here's is it (slightly embarrassed):
>
> It works if I hardcode a string in a script helper:
>
> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=['olá', 
> 'olé']);})" % dict(...images=images), _language='javascript')
>
> It also works if (getting titles from the db, where it is stored as 
> "'olá','olé'" - note single quotes included):
>
> SCRIPT(" ... 
> jQuery.prettyPhoto.open(images=%(images)s,titles=[%(titles)]);})" % 
> dict(images=images, titles=titles), _language='javascript')
>
> However, if I try to parse from the db (where titles is stored as 
> "olá|olé", such as:
> titles = [title.strip() for title in titles.split('|')]
>
> The jQuery string is adequately adjusted to receive a list:
> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=%(titles));})" 
> % dict(images=images, titles=titles), _language='javascript')
>
> All works but when rendered by the browser I do not get: Olá  instead I 
> get: olá
> The same for Olé and olé
>
> My goal is to have a user supplied string, such as: olá|olé
>
> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is 
> awesome :-)
>
> Txs for the help,
> Miguel
>

Reply via email to