Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1829

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/29/1829/1

fdo#59728: Fix encoding of .py files as UTF-8 for Python 3

...where it could default to something like CP 1252 instead on Windows, while
keeping backwards compatibility for now with running under Python 2 (where
things apparently worked well with the original code).

Change-Id: I0ddd06771a36e1cd2cc2ce78abd8bd667db7778f
(cherry picked from commit c2445b03f4d27bbd7e14c4322704ce89b582839b)
---
M pyuno/source/loader/pythonloader.py
1 file changed, 4 insertions(+), 1 deletion(-)



diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py
index 0330a6e..de4d630 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -90,7 +90,10 @@
                     # read the file
                     filename = unohelper.fileUrlToSystemPath( url )
 
-                    fileHandle = open( filename )
+                    if sys.version >= '3':
+                        fileHandle = open( filename, encoding='utf_8' )
+                    else:
+                        fileHandle = open( filename )
                     src = fileHandle.read().replace("\r","")
                     if not src.endswith( "\n" ):
                         src = src + "\n"

-- 
To view, visit https://gerrit.libreoffice.org/1829
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ddd06771a36e1cd2cc2ce78abd8bd667db7778f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Stephan Bergmann <sbergman@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.