Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Cyrillic characters

edited June 2013 in OpenSesame

I wrote simple script based on this post: (many thanks :) )
But my script's outcome is squares. I use Cyrillic characters. I've read forum's post about Farsi, but I don't want use PyGame back-end. I'd prefer PsychoPy. Can you help me?
Here the link on archive with script and files


  • edited 11:11PM


    In principle, you should be able to use Cyrillic text without any problems, because (unlike Farsi, which is a whole different story) Cyrillic is part of most standard fonts. However, I noticed that under Windows 7 you see only question marks. I imagine that's what you get as well, right?

    I'm not completely sure what the underlying problem is, but it has something to do with how OpenSesame represents text internally, which apparently depends on the operating system. For now, you'll have to work around it.

    The easy-but-not-so-convenient way

    You could create bitmaps for all your text, and present them like that. This will of course solve all font-related issues, but it might be very inconvenient.

    The clever way

    You could save your Cyrillic words in separate text files and read them into OpenSesame at runtime. This way they are not part of the experiment script, and do not suffer from the encoding issue. For example, the following script reads text from a file and sets it as the variable [word]. You can then use this variable to show text in a sketchpad, just like you normally would.

    # The path to a file containing a word
    path = exp.get_file('word.txt')
    # A file object
    f = open(path)
    # Reads the contents of the file into a string
    s =
    # Sets the string as variable [word]
    exp.set('word', s)

    The exact way to go about this depends on your experiment, of course, and you'll have to use a bit of Python (but nothing too complicated).


    Buy Me A Coffee

  • edited June 2013

    @sebastiaan Thank you for response, but "clever way" is exactly what I am doing in my script. And it doesn't work. By the way if I write Cyrillic text in sketchpad it's work:

    draw textline 0 0 "тест" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
    # edit:
    # s = 'тест'
    # exp.set('word', s)
    # draw textline 0 0 "[word]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
    # also works

    but if I use your script and:

    draw textline 0 0 "[word]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"

    it shows question marks.
    So maybe it's Python related problems? (I use opensesame_0.27.3~pre1-win32-1 and Windows XP / Windows 7)

  • edited June 2013

    Ok, well you're getting into messy character-encoding territory here ... I don't have a full grasp on it myself (otherwise I would've have fixed it in OpenSesame), but I can give you some tips for this specific case.

    The first thing is to realize that not all files are created equal: Text files have a specific character encoding, in your case Windows-1251, or cp1251 as Python calls it. Therefore, when you read this data in, you have to tell Python what the encoding is, otherwise it won't work.

    Like so:

    # Assuming that stim is a cp1251 encoded str. What we want to do is
    # decode stim into a unicode object, like so:
    stim = stim.decode('cp1251')
    exp.set("stim", stim)

    You may want to take a look at this page, which outlines the (subtle) difference between the Python unicode and str objects:

    Buy Me A Coffee

  • edited 11:11PM

    Yes, it's working. Thanks.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games