ndreynolds / ex_termbox

Low-level termbox bindings for Elixir
MIT License
55 stars 16 forks source link

Some wide characters are not correctly displayed #4

Open qhwa opened 4 years ago

qhwa commented 4 years ago

It seems that some of the Chinese characters are not displayed.

Let's take the hello world for example. Here's a script: https://gist.github.com/qhwa/7ef65acb13ec656cc13d7418d066cfcc

when mix run it, the expected output will be:

Hello, World! 你好世界!

Whilst the current output is

Hello, World! 你世!

Looks like characters at even positions are missing.

Do you happen to have any idea how I can fix it?

FYI. I tried termbox the C program and confirms it works with Chinese characters.

UPDATE: After some digging, I realize it is an issue with ratatouille on calculating positions. It is an issue about wide characters including CJK, full-width Unicode characters and some emojis. It can be fixed with a small patch calculating character width. On my local machine, I have got it working properly at least for some Chinese characters. I can make a pull request on it if it makes sense to you. :)