fix encoding

This commit is contained in:
rustdesk 2022-12-27 22:55:54 +08:00
parent c7f2415aba
commit ff5228f7d4

View File

@ -7,7 +7,7 @@ import csv
def get_lang(lang):
out = {}
for ln in open('./src/lang/%s.rs'%lang):
for ln in open('./src/lang/%s.rs'%lang, encoding='utf8'):
ln = ln.strip()
if ln.startswith('("'):
k, v = line_split(ln)
@ -39,8 +39,8 @@ def expand():
if lang in ['en','cn']: continue
print(lang)
dict = get_lang(lang)
fw = open("./src/lang/%s.rs"%lang, "wt")
for line in open('./src/lang/cn.rs'):
fw = open("./src/lang/%s.rs"%lang, "wt", encoding='utf8')
for line in open('./src/lang/cn.rs', encoding='utf8'):
line_strip = line.strip()
if line_strip.startswith('("'):
k, v = line_split(line_strip)
@ -57,9 +57,9 @@ def expand():
def to_csv():
for fn in glob.glob('./src/lang/*.rs'):
lang = os.path.basename(fn)[:-3]
csvfile = open('./src/lang/%s.csv'%lang, "wt")
csvfile = open('./src/lang/%s.csv'%lang, "wt", encoding='utf8')
csvwriter = csv.writer(csvfile)
for line in open(fn):
for line in open(fn, encoding='utf8'):
line_strip = line.strip()
if line_strip.startswith('("'):
k, v = line_split(line_strip)
@ -68,8 +68,8 @@ def to_csv():
def to_rs(lang):
csvfile = open('%s.csv'%lang, "rt")
fw = open("./src/lang/%s.rs"%lang, "wt")
csvfile = open('%s.csv'%lang, "rt", encoding='utf8')
fw = open("./src/lang/%s.rs"%lang, "wt", encoding='utf8')
fw.write('''lazy_static::lazy_static! {
pub static ref T: std::collections::HashMap<&'static str, &'static str> =
[