# Using Thai in the program

**URL:** https://discourse.processing.org/t/using-thai-in-the-program/36595
**Category:** Processing.py
**Created:** [April 26, 2022, 12:59am UTC](https://discourse.processing.org/t/using-thai-in-the-program/36595 "2022-04-26T00:59:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sys10m](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@sys10m](https://discourse.processing.org/u/sys10m)
#### Post date: [April 26, 2022, 12:59am UTC](https://discourse.processing.org/t/using-thai-in-the-program/36595/1 "2022-04-26T00:59:46Z")

</div>

I am currently working on a super short program which just takes a one word string input (in Thai) and then pass on the python program which has been written. I have a problem with dealing with Thai text. everything from inputing it to displaying it. Anyone has an idea if processing supports Thai or not or anything I can do.

Ps. I have tried enabling complext text input in the program but it does not seem to work for Thai

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [May 1, 2022, 2:12am UTC](https://discourse.processing.org/t/using-thai-in-the-program/36595/2 "2022-05-01T02:12:27Z")

</div>

Hi, @sts10m!

I think things should work if you do some small things: indicate strings are Unicode if you use Thai text in the code, string literals, like `hello_text = u"สวัสดี"` (note the `u` before the `"`). Because this is Jython/Python 2… Otherwise you could use, first thing in your sketch:

```python
from __future__ import unicode_literals

```

Get Processing to select an appropriate font for drawing, maybe like this:

```python
def setup():
    size(400, 400)
    thai_font = createFont('Noto-Sans-Thai.ttf', 24) # put TTF file inside sketch/data/ folder
    textFont(thai_font)

def draw():
    text(u'สวัสดี', 100, 100)

```

If you use multiple tabs, beware the other `.py` files need to start with this “magic” comment:  
`# -*- coding: utf-8 -*-`

What other inputs do you need? Keyboard or reading text files?

Keyboard input in Processing is one key at a time… if Thai script needs key combinations to interact, I’m not sure it would be able to capture those interactions, maybe a dialog window to get the whole word could help?

```python
def input(question='', suggestion=''): # Processing Python mode does not have the built-in input()!!!
    from javax.swing import JOptionPane
    return JOptionPane.showInputDialog(None, question, suggestion)

```

Let us know if any of this works!

Good luck with your projects!
