Explorar el Código

Use unicode when reading/writing svgs

master
Fen Dweller hace 5 años
padre
commit
0e3bc0a2fd
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. +2
    -2
      scripts/add-bounds.py

+ 2
- 2
scripts/add-bounds.py Ver fichero

@@ -16,10 +16,10 @@ for path in Path(sys.argv[1]).rglob('*.svg'):
# I'd rather avoid mangling the XML files by parsing them first # I'd rather avoid mangling the XML files by parsing them first
# XML is awful and we never should have invented it :( # XML is awful and we never should have invented it :(


with open(path, "r") as file:
with open(path, "r", encoding="utf-8") as file:
data = file.read() data = file.read()


data = re.sub('viewBox="0 0', f'width="{width}" height="{height}" viewBox="0 0', data) data = re.sub('viewBox="0 0', f'width="{width}" height="{height}" viewBox="0 0', data)


with open(path, "w") as file:
with open(path, "w", encoding="utf-8") as file:
file.write(data) file.write(data)

Cargando…
Cancelar
Guardar