diff options
-rw-r--r-- | cpp/src/Slice/Python.cpp | 4 | ||||
-rw-r--r-- | python/modules/IcePy/Slice.cpp | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index 09a17a93b4a..4343456efb2 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -665,6 +665,10 @@ Slice::Python::compile(int argc, char* argv[]) } FileTracker::instance()->addFile(file); + // + // Python magic comment to set the file encoding, it must be first or second line + // + out << "# -*- coding: utf-8 -*-\n"; printHeader(out); printGeneratedHeader(out, base + ".ice", "#"); // diff --git a/python/modules/IcePy/Slice.cpp b/python/modules/IcePy/Slice.cpp index bf856f8b654..a4692f6465f 100644 --- a/python/modules/IcePy/Slice.cpp +++ b/python/modules/IcePy/Slice.cpp @@ -161,6 +161,10 @@ IcePy_loadSlice(PyObject* /*self*/, PyObject* args) ostringstream codeStream; IceUtilInternal::Output out(codeStream); out.setUseTab(false); + // + // Python magic comment to set the file encoding, it must be first or second line + // + out << "# -*- coding: utf-8 -*-\n"; generate(u, all, checksum, includePaths, out); u->destroy(); |