Mar-15-2021, 05:38 PM
Hi!
I want to iterate through this dictionary in Flask:
I tried adding # -*- coding: utf-8 -*- comment, importing unicodedata and using Japanese characters instead of code points (found those solutions somewhere on the internet), but nothing worked.
How can I display Japanese characters on the website using Flask? Thanks in advance!
I want to iterate through this dictionary in Flask:
hiragana_dict = {"a": u"\u3042", "i": u"\u3044", "u": u"\u3046", "e": u"\u3048", "o": u"\u304A", "ka": u"\u304B", "ki": u"\u304D", "ku": u"\u304F", "ke": u"\u3051", "ko": u"\u3053", "sa": u"\u3055", "shi": u"\u3057", "su": u"\u3059", "se": u"\u305B", "so": u"\u305D", "ta": u"\u305F", "chi": u"\u3061", "tsu": u"\u3064", "te": u"\u3066", "to": u"\u3068", "na": u"\u306A", "ni": u"\u306B", "nu": u"\u306C", "ne": u"\u306D", "no": u"\u306E", "ha": u"\u306F", "hi": u"\u3072", "fu": u"\u3075", "he": u"\u3078", "ho": u"\u307B", "ma": u"\u307E", "mi": u"\u307F", "mu": u"\u3080", "me": u"\u3081", "mo": u"\u3082", "ya": u"\u3084", "yu": u"\u3086", "yo": u"\u3088", "ra": u"\u3089", "ri": u"\u308A", "ru": u"\u308B", "re": u"\u308C", "ro": u"\u308D", "wa": u"\u308F", "wo": u"\u3092", "n": u"\u3093"}The loop works just fine in Python script in IDE, but when I try to use it in Flask, I get SyntaxError:
Error:File "C:\Users\Ewa\Desktop\KanaSite\kana\kana_app.py", line 28
hiragana_dict = {"a": u"\u3042", "i": u"\u3044", "u": u"\u3046", "e": u"\u3048", "o": u"\u304A",
^
SyntaxError: invalid syntax
(line 28 is just where the dictionary starts)I tried adding # -*- coding: utf-8 -*- comment, importing unicodedata and using Japanese characters instead of code points (found those solutions somewhere on the internet), but nothing worked.
How can I display Japanese characters on the website using Flask? Thanks in advance!