Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e174284

Browse files
committed
Use 'latin_1' encoding instead of ascii
1 parent 92bccd2 commit e174284

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/_png.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds)
293293
text[meta_pos].compression = PNG_TEXT_COMPRESSION_NONE;
294294
#if PY3K
295295
if (PyUnicode_Check(meta_key)) {
296-
PyObject *temp_key = PyUnicode_AsEncodedString(meta_key, "ASCII", "strict");
296+
PyObject *temp_key = PyUnicode_AsEncodedString(meta_key, "latin_1", "strict");
297297
if (temp_key != NULL) {
298298
text[meta_pos].key = PyBytes_AsString(temp_key);
299299
}
@@ -303,7 +303,7 @@ static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds)
303303
text[meta_pos].key = NULL; // Silently drops entry
304304
}
305305
if (PyUnicode_Check(meta_val)) {
306-
PyObject *temp_val = PyUnicode_AsEncodedString(meta_val, "ASCII", "strict");
306+
PyObject *temp_val = PyUnicode_AsEncodedString(meta_val, "latin_1", "strict");
307307
if (temp_val != NULL) {
308308
text[meta_pos].text = PyBytes_AsString(temp_val);
309309
}

0 commit comments

Comments
 (0)