Howdy, Stranger!

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

Supported by

[solved] Combining characters in Hindi text

edited June 2012 in OpenSesame

I'm trying to display Hindi text in OpenSesame (0.26), and most of it is working, except for the "i" character. This is a combining character that is inserted to the right of some consonant, but displays to the left. It appears properly (to the left of the consonant) in the lists within OpenSesame, but when actually running the script and displaying stimuli, it appears to the right of the consonant. Is there some way to deal with this?

Comments

  • edited 1:31AM

    Hi Eamccullough,

    You've already managed to get further than I have! Could you explain in more detail the steps that you have taken so far to show the Hindi text (i.e. how are you showing the text? What font are you using?).

    Alternatively, a quick and dirty way to show text is of course to create bitmaps for each sentence. But depending on the experiment, this may not be a convenient solution of course.

    Cheers,
    Sebastiaan

    Buy Me A Coffee

  • edited 1:31AM

    The bitmap route is my backup plan, but I figured I'd at least ask about this first!

    I've followed the instructions given for non-western alphabets here:
    http://osdoc.cogsci.nl/miscellaneous/non-western-alphabets
    The Hindi text exists as entries in a list, and is shown on a sketchpad. I've tried four different fonts (mostly Mangal, but also Aparajita, Kokila, and Utsaah), and the same problem occurs with all of them. I have been populating the lists (where everything appears correctly) by pasting from an Excel spreadsheet (where everything appears correctly). Almost everything appears correctly when running the script, save for this one character.

  • edited 1:31AM

    I see. I took me a while to understand what was happening here, but the basic problem is that the i is not automatically put before the preceding character. The Unicode notation for the i sign is U+093F, so

    U+0915U+093F

    should become

    U+093FU+0915

    This doesn't happen automatically, but if you open the inline_script and reverse the Unicode yourself it should work. Does this make sense?

    Alternatively, you can automatically fix the text with a regular expression. As far as I can tell, the code below flips the i's to make it work. But since I don't understand Hindi I can't be sure!

    You need to insert this code to the prepare phase of an inline_script at the start of a trial. Adjust src_var to match the name of the variable that you want to fix.

    import re
    src_var = 'text'
    s = self.get(src_var)
    # A horrible regular expression to circumvent that inline
    # scripts dont't deal well with backslashes
    s = re.sub(r'U'+chr(92)+'+('+chr(92)+'w'+chr(92)+'w'+chr(92)+'w'+chr(92)+'w)U'+chr(92)+'+093F',
        'U+'+'093FU+'+chr(92)+'1', s)
    exp.set(src_var, s)

    Hope this helps!

    Buy Me A Coffee

  • edited 1:31AM

    Thanks! I used the regular expression approach, and it worked quite well, in that the script runs without issue and everything displays properly. I do get an error message when I click on the inline_script object after creating it, though:

    invalid literal for int() with base 16: "'+'0" (Edit the script to fix this)

    I'm not sure what this means, but I'm sharing it mainly for posterity, as my immediate issue has been solved. Thanks again!

  • edited 1:31AM

    Ah, thanks for pointing that out! It's a bug in the way that the Unicode notation (U+1234) is parsed, but it should be easily fixed.

    Good to hear that the script is working for you.

    Buy Me A Coffee

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 http://45.77.173.118/ 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