1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-14 22:42:34 +02:00
ScreenPlay/ScreenPlayWorkshop/SteamSDK/convert_steam_sdk_to_utf8.py
Elias Steurer 157823739d Update SteamSDK to 1.53a
Fix invalid utf8 files via convert_steam_sdk_to_utf8.py
2022-01-09 17:13:56 +01:00

19 lines
684 B
Python

import json
import os
# open all files in subfolder public and convert to utf8
for root, dirs, files in os.walk("public/steam"):
for file in files:
if file.endswith(".h"):
path = os.path.join(root, file)
data = ""
try:
with open(path, 'r', encoding='utf-8', errors='strict') as f:
data = f.read()
except UnicodeDecodeError:
print("Converting " + file)
with open(path, 'r', encoding='cp1252') as infile:
data = infile.read()
with open(path, 'w', encoding='utf-8') as outfile:
outfile.write(data)