[Addon] Unicode Helper

Lately I have noticed, that people are having trouble to use Text objects with special characters in Blender 2.5x. Why? Because blender will not let you to enter characters other than ACII. There are some work-arounds, but they are time consuming and inefficient. So, I thought why not to help fellow Blender users, and not to write Add-On for that?
Idea was simple: let people add characters by character code. Later it was extended by possibility to import text from external file. Currently it is still open to suggestions for further improvements.

Instructions:

  1. Download the script from here: unicode_helper.py.
  2. Copy to scripts/addons folder
  3. Enable “Unicode Helper” addon from “Object” category
  4. Create text object and set font that supports unicode characters. Internal Bfont does not.
  5. Select Text object, and use the addon from Tools menu.

UI:

Additional character is appended immediately, and is changed when changing code. Hope it will save somebody a minute or two.

Awesome as awesome can be
i was a bit frustrated as i can’t past characters from clipboard into text object.
one suggestion though, can you implement a reverse string operator in it for RTL languages?
you can add it as a check box, i can help you with that :slight_smile:

thanks for this great addon, and i’m including it in my next build :slight_smile: (if Allah wishes)

ok, tested and works okay but it doesn’t support all unicode chars, and it would be good if you could input using Unicode like this U+FEF1, instead of to searching through code numbers.

Update: script version 0.1.3

bat3a: I have added option to insert character at the beginning of the line. Script updated at the download location. Thanks for your comments.

I also was thinking about entering hexadecimal code directly, since unicode marks characters in hex. But Blender does not have nice slider for hexadecimals, like regular IntegerProperty has (at least I don’t know). Seems like it is still needed, so I will add it in the next update.

Font support is limited by the selected font, and font of the UI. I haven’t seen an unicode font, which supports all the characters :slight_smile:

@Shwarnas: glad to see you did this thing as addon.

Maybe it would make sense to add as an ?tooltip or reference-text
the link to the unicode-web-page:

> http://unicode.org/charts/
and with pdf-view and naming of popular chars:
> http://unicode.org/charts/charindex.html
(number is there used as hex-code)

this might it make easy to understand more about this thing and
why the correct unicode-number is not enough and the selected
font has to be made for such a number too.

Font support is limited by the selected font, and font of the UI. I haven’t seen an unicode font, which supports all the characters

check the blender “2.60\datafiles\fonts” folder, it has a unicode font which supports all languages i think!, it could help you with tests.
as more testing, i found it does not import unicode files or utf-8 ones.

i’d like to give you another suggestion:
you can link a text field to the text object and it modifies on entering edit mode and outing of edit mode.

bat3a: it does import utf-8 files flawlessly. If you see rectangles instead of characters - your font does not support given characters. I have made a test file, with quite exotic characters. You can test it, and don’t be surprised to see a lot of rectangles - it’s a matter of font. Btw, best results I have achieved with FreeSans (FreeSans.ttf) font. It does not support Chinese symbols, but almost everything else looks fine.

utf8_test.txt.zip (1.69 KB)

Script version 0.1.4

  • Added possibility to enter HEX code (on the right of the slider)
  • Removed char and HEX preview
  • Added checkbox, called “Character Map” :slight_smile:

Download location is the same

Hi!
I’ve just test this awesome script with Hebrew text file and got strange character after that I test it with your test text file and got an error (see pictures below, Blender rev 41207)



another thing, I have an idea and want to hear what do you think:
can you add text box for adding characters and a start Unicode position text box so you will add the start Unicode position of the first character and enter only the offset? (you can add also a drop box of the starting point of each language to choose from for help).

Thank you for this script, it will be helpful a lot!!! :yes:

her is an image with the test file you proposed, i used the blender font (and as i said before it contains the most languages):


tested also with local fonts with the same results,
after the unicode updates to blender they added new writing api, you should check that maybe!

still testing the new version, thanks for updating :slight_smile:

@yaniv: let me guess, you have opened utf8_test.txt with windows notepad, saved it, and tried to import it in blender with Unicode Helper? Despite the fact, that windows notepad is the worst text editor, it is even worse when it comes to editing UTF-8 files. When saving UTF-8 with notepad, it adds some bytes at the beginning of the file, to indicate, that it’s utf-8 file. And those bytes are not real symbols. Python fails to map those bytes to char, and it fails. Solution: don’t use notepad. My recommendation for windows is Notepad++, in linux default gedit works just fine. Of course I will add exception handling to avoid this error too.

About the idea… it sounds complicated, and I think it will be solved easier, when unicode input will be available in 2.61. This Add-On will serve only for characters, that you cannot reach with keyboard.

@bat3a: I am attaching screenshots, how utf8_test.txt looks in editor, and in blender

gedit:


Blender, two objects with same text and different fonts:


I think demo video asks itself to be recorded, to avoid some confusion…