On 29/12/2015 at 13:35, xxxxxxxx wrote:
My Plugin will be used in more programs than C4D so I'm loading my strings in from a .txt file.
When the .txt file is saved with endoding = 'ANSI' it works fine for any languages that use characters in that set.
However, if someone wants to display other characters, say Japanese, then the this won't work.
I tried saving the text file with 'UTF-8' and 'Unicode', but I can't get them to display properly on a button. Here is a line for a button with the text stored in a dictionary named 'gl_str_dict':
self.AddButton(LOAD_DATA, flags=c4d.BFH_LEFT | c4d.BFH_SCALEFIT, initw=self.four_column_button_width, inith = self.button_height, name=gl_str_dict["BUTTON_OPEN_FILE"])
My text file is format:
BUTTON_OPEN_FILE:Open File
My text file is read in like this:
with open(file_path) as myfile:
raw_list = "".join(line.replace('/', os.sep) for line in myfile).split('\n')
gl_str_dict = {x.split(':')[0]: x.split(':')[1] for x in raw_list}
How do you make this work with unicode characters?
Can you display Japanese and other unicode characters?
Thanks