psychopy.org | Reference | Downloads | Github

Including utf-8/unicode characters in online experiments


#1

URL of experiment: https://pavlovia.org/run/jvcasillas/lextale_sp_template/html/

Description of the problem: I am preparing an online experiment in Spanish and have noticed that accented characters that work locally do not show up online. I have tried using the unicode characters, the dec and the hex, but nothing seems to work.


#2

Hi @jvcasillas

The index.html file for running your experiments online should have page encoding <meta charset="utf-8">, which will include accented characters. I just tried running accented characters online from a text component, and this worked ok. Are you attempting to import accented characters from conditions file?


#3

Hi @dvbridges

I noticed that about the index.html file. I am, indeed, pulling words randomly from a conditions file and these words contain accented characters. Is there a workaround for this? I have also tried listing the words with u= beforehand to no avail.


#4

For the time being I have just removed the accented characters. I opened a github issue here: https://github.com/psychopy/psychopy/issues/2299

and for the sake of completeness I will report back when this has a solution.


#5

I’m in a bit of a time crunch so I’m coming back to this one to see if anybody (@dvbridges perhaps) has any ideas for workarounds. Is it possible to force the encoding of item in list using something like u"?


#6

Hi @jvcasillas, have you tried saving your csv so it is specifically compatible with UTF-8? When you “Save as”, try the web options in the tools menu next to the “Save” button. Go to the “encoding” tab and select “UTF-8” from the “save document as” drop down menu.

Not sure if that will work, but worth a try!


#7

I hadn’t considered trying an excel file. I was using a .csv and saving with utf-8 encoding, but apparently that wasn’t working. I just passed the list to an excel file and the accented characters are now showing up as they should. Thank you, once again, for your insights. I will update the github issue as well.