BLF + Unicode Text + File Parser

So,
i was thinking of how to use the blf module to display unicode text in BGE 2.59 and come up with this idea :yes:.
This basically parse a unicode text from a text file and display it correctly on Blender Game.
More info on the .blend file
So Check it out!

Download Link:
http://db.tt/YBNd6VNB

Hey that looks awesome! I wasn’t able to run it yet but moderators should move this post to wip or resources :slight_smile:

I get this error:


D:\Users\Monster\Documents\3D\Blender\Demos\by Karakasimov\blf_unicode_test\
Traceback (most recent call last):
  File "blf_draw.py", line 26, in write
  File "...\blf_unicode_test\blf_unicode_test.blend\parse_file.py", line 6, in read_file
  File "...\2.59\python\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5: character maps to <undefined>

(I have shortend the paths)

You might need to explicit set the codec.

i got it worked in linux, haven’t looked into windows. i’ll try to do a test on windows machine and try to resolve it asap.

It might be the line endings messing it up. A good way is to let the JSON module handle all the pesky details. In most apps You want a set of strings anyway - not just one text. JSON let You define a arbitrary nested set of lists and dictionary’s of Unicode strings - and You can throw other types in there to.

@LaH
Yeah there’s a line ending issue. i ignored it by removing the last character from the string.
i might have to look into the JSON module that you’ve mentioned and redo the whole setup and post the update.
Thanks for the info.