Changed code to make eric compatible to PyQt 5.5 (QByteArry issue). 6_0_x

Sat, 25 Jul 2015 12:58:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 25 Jul 2015 12:58:42 +0200
branch
6_0_x
changeset 4330
2c278493b31e
parent 4329
399e14805a5c
child 4333
ec0664f353b3

Changed code to make eric compatible to PyQt 5.5 (QByteArry issue).

Cooperation/Connection.py file | annotate | diff | comparison | revisions
E5Gui/E5ToolBarManager.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockManager.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockNetwork.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockRule.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockSubscription.py file | annotate | diff | comparison | revisions
Helpviewer/CookieJar/CookieJar.py file | annotate | diff | comparison | revisions
Helpviewer/GreaseMonkey/GreaseMonkeyManager.py file | annotate | diff | comparison | revisions
Helpviewer/HelpBrowserWV.py file | annotate | diff | comparison | revisions
Helpviewer/HelpLanguagesDialog.py file | annotate | diff | comparison | revisions
Helpviewer/HelpTabWidget.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
Helpviewer/History/HistoryManager.py file | annotate | diff | comparison | revisions
Helpviewer/Network/EricAccessHandler.py file | annotate | diff | comparison | revisions
Helpviewer/Network/NetworkAccessManager.py file | annotate | diff | comparison | revisions
Helpviewer/OpenSearch/OpenSearchEngine.py file | annotate | diff | comparison | revisions
Helpviewer/Passwords/PasswordManager.py file | annotate | diff | comparison | revisions
Helpviewer/UrlBar/UrlBar.py file | annotate | diff | comparison | revisions
Helpviewer/VirusTotalApi.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/CodeStyleChecker/pep8.py file | annotate | diff | comparison | revisions
Preferences/__init__.py file | annotate | diff | comparison | revisions
Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
QScintilla/QsciScintillaCompat.py file | annotate | diff | comparison | revisions
Utilities/crypto/__init__.py file | annotate | diff | comparison | revisions
--- a/Cooperation/Connection.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Cooperation/Connection.py	Sat Jul 25 12:58:42 2015 +0200
@@ -140,7 +140,8 @@
         
         msg = QByteArray(message.encode("utf-8"))
         data = QByteArray("{0}{1}{2}{1}".format(
-            Connection.ProtocolMessage, SeparatorToken, msg.size())) + msg
+            Connection.ProtocolMessage, SeparatorToken, msg.size())
+            .encode("utf-8")) + msg
         return self.write(data) == data.size()
     
     def timerEvent(self, evt):
@@ -266,8 +267,8 @@
         """
         greeting = QByteArray(self.__greetingMessage.encode("utf-8"))
         data = QByteArray("{0}{1}{2}{1}".format(
-            Connection.ProtocolGreeting, SeparatorToken, greeting.size())) + \
-            greeting
+            Connection.ProtocolGreeting, SeparatorToken, greeting.size())
+            .encode("utf-8")) + greeting
         if self.write(data) == data.size():
             self.__isGreetingMessageSent = True
     
@@ -427,7 +428,8 @@
             message = "<empty>"
         msg = QByteArray(message.encode("utf-8"))
         data = QByteArray("{0}{1}{2}{1}".format(
-            Connection.ProtocolParticipants, SeparatorToken, msg.size())) + msg
+            Connection.ProtocolParticipants, SeparatorToken, msg.size())
+            .encode("utf-8")) + msg
         self.write(data)
     
     def sendEditorCommand(self, projectHash, filename, message):
@@ -442,7 +444,8 @@
         msg = QByteArray("{0}{1}{2}{1}{3}".format(
             projectHash, SeparatorToken, filename, message).encode("utf-8"))
         data = QByteArray("{0}{1}{2}{1}".format(
-            Connection.ProtocolEditor, SeparatorToken, msg.size())) + msg
+            Connection.ProtocolEditor, SeparatorToken, msg.size())
+            .encode("utf-8")) + msg
         self.write(data)
     
     def __disconnected(self):
--- a/E5Gui/E5ToolBarManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/E5Gui/E5ToolBarManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -470,18 +470,18 @@
         for tbID in self.__defaultToolBars:
             tb = self.__allToolBars[tbID]
             if tb.objectName():
-                stream.writeString(tb.objectName().encode())
+                stream.writeString(tb.objectName().encode("utf-8"))
             else:
-                stream.writeString(tb.windowTitle().encode())
+                stream.writeString(tb.windowTitle().encode("utf-8"))
             stream.writeUInt16(len(self.__toolBars[tbID]))
             for action in self.__toolBars[tbID]:
                 if action is not None:
                     if action.objectName():
-                        stream.writeString(action.objectName().encode())
+                        stream.writeString(action.objectName().encode("utf-8"))
                     else:
-                        stream.writeString(action.text().encode())
+                        stream.writeString(action.text().encode("utf-8"))
                 else:
-                    stream.writeString("".encode())
+                    stream.writeString("".encode("utf-8"))
         
         # save the custom toolbars
         stream.writeUInt16(E5ToolBarManager.CustomToolBarMarker)
@@ -489,17 +489,17 @@
         for tbID in self.__toolBars:
             if tbID not in self.__defaultToolBars:
                 tb = self.__allToolBars[tbID]
-                stream.writeString(tb.objectName().encode())
-                stream.writeString(tb.windowTitle().encode())
+                stream.writeString(tb.objectName().encode("utf-8"))
+                stream.writeString(tb.windowTitle().encode("utf-8"))
                 stream.writeUInt16(len(self.__toolBars[tbID]))
                 for action in self.__toolBars[tbID]:
                     if action is not None:
                         if action.objectName():
-                            stream.writeString(action.objectName().encode())
+                            stream.writeString(action.objectName().encode("utf-8"))
                         else:
-                            stream.writeString(action.text().encode())
+                            stream.writeString(action.text().encode("utf-8"))
                     else:
-                        stream.writeString("".encode())
+                        stream.writeString("".encode("utf-8"))
         
         return data
     
--- a/Helpviewer/AdBlock/AdBlockManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/AdBlock/AdBlockManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -298,7 +298,7 @@
             subscriptions = [self.__defaultSubscriptionUrlString,
                              self.__customSubscriptionUrlString]
         for subscription in subscriptions:
-            url = QUrl.fromEncoded(subscription.encode())
+            url = QUrl.fromEncoded(subscription.encode("utf-8"))
             adBlockSubscription = AdBlockSubscription(
                 url,
                 subscription.startswith(self.__customSubscriptionUrlString),
@@ -327,7 +327,7 @@
                 return
         
         # Step 2: if it is not, get it
-        url = QUrl.fromEncoded(urlString.encode())
+        url = QUrl.fromEncoded(urlString.encode("utf-8"))
         adBlockSubscription = AdBlockSubscription(url, False, self)
         self.addSubscription(adBlockSubscription)
         self.requiredSubscriptionLoaded.emit(adBlockSubscription)
--- a/Helpviewer/AdBlock/AdBlockNetwork.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/AdBlock/AdBlockNetwork.py	Sat Jul 25 12:58:42 2015 +0200
@@ -30,7 +30,7 @@
         urlString = bytes(url.toEncoded()).decode()
         urlDomain = url.host()
         urlScheme = url.scheme()
-        refererHost = QUrl.fromEncoded(request.rawHeader("Referer")).host()
+        refererHost = QUrl.fromEncoded(request.rawHeader(b"Referer")).host()
         
         import Helpviewer.HelpWindow
         manager = Helpviewer.HelpWindow.HelpWindow.adBlockManager()
--- a/Helpviewer/AdBlock/AdBlockRule.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/AdBlock/AdBlockRule.py	Sat Jul 25 12:58:42 2015 +0200
@@ -423,7 +423,7 @@
         @param req request object to check (QNetworkRequest)
         @return flag indicating a match (boolean)
         """
-        match = req.rawHeader("X-Request-With") == "XMLHttpRequest"
+        match = req.rawHeader(b"X-Request-With") == "XMLHttpRequest"
         
         if self.__xmlhttprequestException:
             return not match
--- a/Helpviewer/AdBlock/AdBlockSubscription.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/AdBlock/AdBlockSubscription.py	Sat Jul 25 12:58:42 2015 +0200
@@ -118,7 +118,8 @@
             urlQuery = QUrlQuery(url)
             self.__title = urlQuery.queryItemValue("title")
             self.__enabled = urlQuery.queryItemValue("enabled") != "false"
-            self.__location = QByteArray(urlQuery.queryItemValue("location"))
+            self.__location = QByteArray(urlQuery.queryItemValue("location")
+                .encode("utf-8"))
             
             # Check for required subscription
             self.__requiresLocation = urlQuery.queryItemValue(
@@ -139,7 +140,7 @@
             self.__enabled = QUrl.fromPercentEncoding(
                 url.encodedQueryItemValue("enabled")) != "false"
             self.__location = QByteArray(QUrl.fromPercentEncoding(
-                url.encodedQueryItemValue("location")))
+                url.encodedQueryItemValue("location")).encode("utf-8"))
             
             # Check for required subscription
             self.__requiresLocation = QUrl.fromPercentEncoding(
--- a/Helpviewer/CookieJar/CookieJar.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/CookieJar/CookieJar.py	Sat Jul 25 12:58:42 2015 +0200
@@ -261,7 +261,7 @@
             for cookie in cookieList:
                 lst = []
                 if not (self.__filterTrackingCookies and
-                        cookie.name().startsWith("__utm")):
+                        cookie.name().startsWith(b"__utm")):
                     if eAllowSession:
                         cookie.setExpirationDate(QDateTime())
                     if self.__keepCookies == self.KeepUntilTimeLimit and \
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/GreaseMonkey/GreaseMonkeyManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -303,7 +303,7 @@
         @return reference to the created reply object (QNetworkReply)
         """
         if op == QNetworkAccessManager.GetOperation and \
-           request.rawHeader("X-Eric6-UserLoadAction") == QByteArray("1"):
+           request.rawHeader(b"X-Eric6-UserLoadAction") == QByteArray(b"1"):
             urlString = request.url().toString(
                 QUrl.RemoveFragment | QUrl.RemoveQuery)
             if urlString.endswith(".user.js"):
--- a/Helpviewer/HelpBrowserWV.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/HelpBrowserWV.py	Sat Jul 25 12:58:42 2015 +0200
@@ -238,8 +238,8 @@
                                      self.__lastRequestType)
                 if self.__lastRequestType == \
                         QWebPage.NavigationTypeLinkClicked:
-                    request.setRawHeader("X-Eric6-UserLoadAction",
-                                         QByteArray("1"))
+                    request.setRawHeader(b"X-Eric6-UserLoadAction",
+                                         QByteArray(b"1"))
         except TypeError:
             pass
     
--- a/Helpviewer/HelpLanguagesDialog.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/HelpLanguagesDialog.py	Sat Jul 25 12:58:42 2015 +0200
@@ -143,7 +143,7 @@
             if qvalue > 0.1:
                 qvalue -= 0.1
         
-        return QByteArray(", ".join(processed))
+        return QByteArray(", ".join(processed).encode("utf-8"))
     
     @classmethod
     def defaultAcceptLanguages(cls):
--- a/Helpviewer/HelpTabWidget.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/HelpTabWidget.py	Sat Jul 25 12:58:42 2015 +0200
@@ -249,7 +249,7 @@
             return
         
         req = QNetworkRequest(self.widget(idx).url())
-        req.setRawHeader("X-Eric6-UserLoadAction", b"1")
+        req.setRawHeader(b"X-Eric6-UserLoadAction", b"1")
         self.newBrowser(None, (req, QNetworkAccessManager.GetOperation, b""))
     
     def __tabContextMenuClose(self):
@@ -857,7 +857,7 @@
         edit = self.sender()
         url = self.__guessUrlFromPath(edit.text())
         request = QNetworkRequest(url)
-        request.setRawHeader("X-Eric6-UserLoadAction", b"1")
+        request.setRawHeader(b"X-Eric6-UserLoadAction", b"1")
         if e5App().keyboardModifiers() == Qt.AltModifier:
             self.newBrowser(
                 None, (request, QNetworkAccessManager.GetOperation, b""))
@@ -905,7 +905,7 @@
             return url
         
         urlString = Preferences.getHelp("DefaultScheme") + path.strip()
-        url = QUrl.fromEncoded(urlString.encode(), QUrl.TolerantMode)
+        url = QUrl.fromEncoded(urlString.encode("utf-8"), QUrl.TolerantMode)
         
         return url
     
--- a/Helpviewer/HelpWindow.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/HelpWindow.py	Sat Jul 25 12:58:42 2015 +0200
@@ -2630,7 +2630,7 @@
         if not self.__activating:
             self.__activating = True
             req = QNetworkRequest(url)
-            req.setRawHeader("X-Eric6-UserLoadAction", b"1")
+            req.setRawHeader(b"X-Eric6-UserLoadAction", b"1")
             self.currentBrowser().setSource(
                 None, (req, QNetworkAccessManager.GetOperation, b""))
             self.__activating = False
@@ -3205,7 +3205,7 @@
         @param title title of the bookmark (string)
         """
         req = QNetworkRequest(url)
-        req.setRawHeader("X-Eric6-UserLoadAction", b"1")
+        req.setRawHeader(b"X-Eric6-UserLoadAction", b"1")
         self.newTab(None, (req, QNetworkAccessManager.GetOperation, b""))
         
     @classmethod
@@ -3680,7 +3680,8 @@
             except IOError:
                 pass
         
-        encodedStyle = bytes(QByteArray(userStyle).toBase64()).decode()
+        encodedStyle = bytes(QByteArray(userStyle.encode("utf-8")).toBase64())\
+            .decode()
         dataString = "data:text/css;charset=utf-8;base64,{0}".format(
             encodedStyle)
         
--- a/Helpviewer/History/HistoryManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/History/HistoryManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -481,7 +481,7 @@
             stream.setVersion(QDataStream.Qt_4_6)
             itm = self.__history[index]
             stream.writeUInt32(HISTORY_VERSION)
-            stream.writeString(itm.url.encode())
+            stream.writeString(itm.url.encode("utf-8"))
             stream << itm.dateTime
             stream.writeString(itm.title.encode('utf-8'))
             f.write(data)
--- a/Helpviewer/Network/EricAccessHandler.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/Network/EricAccessHandler.py	Sat Jul 25 12:58:42 2015 +0200
@@ -58,8 +58,8 @@
             htmlFile.open(QFile.ReadOnly)
             html = htmlFile.readAll()
             
-            html.replace("@IMAGE@", "qrc:icons/ericWeb32.png")
-            html.replace("@FAVICON@", "qrc:icons/ericWeb16.png")
+            html.replace("@IMAGE@", b"qrc:icons/ericWeb32.png")
+            html.replace("@FAVICON@", b"qrc:icons/ericWeb16.png")
             
             self._homePage = html
         
@@ -113,11 +113,11 @@
             self._speedDialPage = Utilities.html_uencode(html)
         
         import Helpviewer.HelpWindow
-        html = QByteArray(self._speedDialPage)
+        html = QByteArray(self._speedDialPage.encode("utf-8"))
         dial = Helpviewer.HelpWindow.HelpWindow.speedDial()
         
-        html.replace("@INITIAL-SCRIPT@", dial.initialScript())
-        html.replace("@ROW-PAGES@", str(dial.pagesInRow()))
-        html.replace("@SD-SIZE@", str(dial.sdSize()))
+        html.replace("@INITIAL-SCRIPT@", dial.initialScript().encode("utf-8"))
+        html.replace("@ROW-PAGES@", str(dial.pagesInRow()).encode("utf-8"))
+        html.replace("@SD-SIZE@", str(dial.sdSize()).encode("utf-8"))
         
         return html
--- a/Helpviewer/Network/NetworkAccessManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/Network/NetworkAccessManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -141,18 +141,18 @@
             return reply
         
         req = QNetworkRequest(request)
-        if req.rawHeader("X-Eric6-UserLoadAction") == QByteArray("1"):
-            req.setRawHeader("X-Eric6-UserLoadAction", QByteArray())
+        if req.rawHeader(b"X-Eric6-UserLoadAction") == QByteArray(b"1"):
+            req.setRawHeader(b"X-Eric6-UserLoadAction", QByteArray())
             req.setAttribute(QNetworkRequest.User + 200, "")
         else:
             req.setAttribute(
-                QNetworkRequest.User + 200, req.rawHeader("Referer"))
+                QNetworkRequest.User + 200, req.rawHeader(b"Referer"))
         
         if hasattr(QNetworkRequest, 'HttpPipeliningAllowedAttribute'):
             req.setAttribute(
                 QNetworkRequest.HttpPipeliningAllowedAttribute, True)
         if not self.__acceptLanguage.isEmpty():
-            req.setRawHeader("Accept-Language", self.__acceptLanguage)
+            req.setRawHeader(b"Accept-Language", self.__acceptLanguage)
         
         # AdBlock code
         if op == QNetworkAccessManager.GetOperation:
@@ -184,12 +184,13 @@
         
         # Do Not Track feature
         if self.__doNotTrack:
-            req.setRawHeader("DNT", "1")
+            req.setRawHeader(b"DNT", b"1")
+            req.setRawHeader(b"X-Do-Not-Track", b"1")
         
         # Send referer header?
         if not self.__sendReferer and \
            req.url().host() not in Preferences.getHelp("SendRefererWhitelist"):
-            req.setRawHeader("Referer", "")
+            req.setRawHeader(b"Referer", b"")
         
         reply = QNetworkAccessManager.createRequest(
             self, op, req, outgoingData)
--- a/Helpviewer/OpenSearch/OpenSearchEngine.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/OpenSearch/OpenSearchEngine.py	Sat Jul 25 12:58:42 2015 +0200
@@ -151,7 +151,7 @@
             return QUrl()
         
         ret = QUrl.fromEncoded(
-            self.parseTemplate(searchTerm, self._searchUrlTemplate))
+            self.parseTemplate(searchTerm, self._searchUrlTemplate).encode("utf-8"))
         
         if self.__searchMethod != "post":
             if qVersion() >= "5.0.0":
@@ -206,7 +206,7 @@
             return QUrl()
         
         ret = QUrl.fromEncoded(QByteArray(self.parseTemplate(
-            searchTerm, self._suggestionsUrlTemplate)))
+            searchTerm, self._suggestionsUrlTemplate).encode("utf-8")))
         
         if self.__searchMethod != "post":
             if qVersion() >= "5.0.0":
@@ -337,7 +337,7 @@
             return
         
         reply = self.__networkAccessManager.get(
-            QNetworkRequest(QUrl.fromEncoded(self._imageUrl)))
+            QNetworkRequest(QUrl.fromEncoded(self._imageUrl.encode("utf-8"))))
         reply.finished.connect(self.__imageObtained)
         self.__replies.append(reply)
     
@@ -359,7 +359,7 @@
         if response.isEmpty():
             return
         
-        if response.startsWith("<html>") or response.startsWith("HTML"):
+        if response.startsWith(b"<html>") or response.startsWith(b"HTML"):
             self.__iconMoved = True
             self.__image = QImage()
         else:
--- a/Helpviewer/Passwords/PasswordManager.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/Passwords/PasswordManager.py	Sat Jul 25 12:58:42 2015 +0200
@@ -343,7 +343,7 @@
             self.__load()
         
         # determine the url
-        refererHeader = request.rawHeader("Referer")
+        refererHeader = request.rawHeader(b"Referer")
         if refererHeader.isEmpty():
             return
         url = QUrl.fromEncoded(refererHeader)
@@ -366,10 +366,10 @@
             return
         
         # determine the requests content type
-        contentTypeHeader = request.rawHeader("Content-Type")
+        contentTypeHeader = request.rawHeader(b"Content-Type")
         if contentTypeHeader.isEmpty():
             return
-        multipart = contentTypeHeader.startsWith("multipart/form-data")
+        multipart = contentTypeHeader.startsWith(b"multipart/form-data")
         if multipart:
             boundary = contentTypeHeader.split(" ")[1].split("=")[1]
         else:
@@ -469,12 +469,13 @@
             if qVersion() >= "5.0.0":
                 from PyQt5.QtCore import QUrlQuery
                 argsUrl = QUrl.fromEncoded(
-                    QByteArray("foo://bar.com/?" + QUrl.fromPercentEncoding(
-                        data.replace(b"+", b"%20"))))
+                    QByteArray(b"foo://bar.com/?" + QUrl.fromPercentEncoding(
+                        data.replace(b"+", b"%20")).encode("utf-8")))
                 encodedArgs = QUrlQuery(argsUrl).queryItems()
             else:
                 argsUrl = QUrl.fromEncoded(
-                    QByteArray("foo://bar.com/?" + data.replace(b"+", b"%20")))
+                    QByteArray(b"foo://bar.com/?" + data.replace(b"+", b"%20"))
+                )
                 encodedArgs = argsUrl.queryItems()
             args = set()
             for arg in encodedArgs:
--- a/Helpviewer/UrlBar/UrlBar.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/UrlBar/UrlBar.py	Sat Jul 25 12:58:42 2015 +0200
@@ -434,7 +434,7 @@
         if mimeData.hasUrls():
             url = mimeData.urls()[0]
         elif mimeData.hasText():
-            url = QUrl.fromEncoded(mimeData.text().encode(), QUrl.TolerantMode)
+            url = QUrl.fromEncoded(mimeData.text().encode("utf-8"), QUrl.TolerantMode)
         
         if url.isEmpty() or not url.isValid():
             E5LineEdit.dropEvent(self, evt)
--- a/Helpviewer/VirusTotalApi.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Helpviewer/VirusTotalApi.py	Sat Jul 25 12:58:42 2015 +0200
@@ -112,7 +112,7 @@
         request.setHeader(QNetworkRequest.ContentTypeHeader,
                           "application/x-www-form-urlencoded")
         params = QByteArray("key={0}&resource={1}".format(
-            key, self.TestServiceKeyScanID))
+            key, self.TestServiceKeyScanID).encode("utf-8"))
         
         import Helpviewer.HelpWindow
         nam = Helpviewer.HelpWindow.HelpWindow.networkAccessManager()
@@ -148,7 +148,7 @@
         request.setHeader(QNetworkRequest.ContentTypeHeader,
                           "application/x-www-form-urlencoded")
         params = QByteArray("key={0}&url=".format(
-            Preferences.getHelp("VirusTotalServiceKey")))\
+            Preferences.getHelp("VirusTotalServiceKey")).encode("utf-8"))\
             .append(QUrl.toPercentEncoding(url.toString()))
         
         import Helpviewer.HelpWindow
@@ -184,7 +184,7 @@
         request.setHeader(QNetworkRequest.ContentTypeHeader,
                           "application/x-www-form-urlencoded")
         params = QByteArray("key={0}&resource={1}".format(
-            Preferences.getHelp("VirusTotalServiceKey"), scanId))
+            Preferences.getHelp("VirusTotalServiceKey"), scanId).encode("utf-8"))
         
         import Helpviewer.HelpWindow
         nam = Helpviewer.HelpWindow.HelpWindow.networkAccessManager()
@@ -219,6 +219,6 @@
         request.setHeader(QNetworkRequest.ContentTypeHeader,
                           "application/x-www-form-urlencoded")
         op = QNetworkAccessManager.PostOperation
-        params = QByteArray("chain=").append(QUrl.toPercentEncoding(term))
+        params = QByteArray(b"chain=").append(QUrl.toPercentEncoding(term))
         
         return (request, op, params)
--- a/Plugins/CheckerPlugins/CodeStyleChecker/pep8.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/pep8.py	Sat Jul 25 12:58:42 2015 +0200
@@ -1046,7 +1046,7 @@
 ##############################################################################
 
 
-if '' == ''.encode():
+if '' == ''.encode("utf-8"):
     # Python 2: implicit encoding.
     def readlines(filename):
         """Read the source code."""
--- a/Preferences/__init__.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Preferences/__init__.py	Sat Jul 25 12:58:42 2015 +0200
@@ -1502,13 +1502,13 @@
             profiles = json.loads(profiles)
             for name in ["edit", "debug"]:
                 viewProfiles[name] = [
-                    QByteArray.fromBase64(profiles[name][0].encode()),
+                    QByteArray.fromBase64(profiles[name][0].encode("utf-8")),
                     profiles[name][1][:],
                     []
                 ]
                 for bs in profiles[name][2]:
                     viewProfiles[name][2].append(
-                        QByteArray.fromBase64(bs.encode()))
+                        QByteArray.fromBase64(bs.encode("utf-8")))
         else:
             # migrate from the old ViewProfiles settings
             try:
--- a/Project/CreateDialogCodeDialog.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Project/CreateDialogCodeDialog.py	Sat Jul 25 12:58:42 2015 +0200
@@ -293,7 +293,8 @@
                             for index in range(len(parameterNames)):
                                 if not parameterNames[index]:
                                     parameterNames[index] = \
-                                        QByteArray("p{0:d}".format(index))
+                                        QByteArray("p{0:d}".format(index)
+                                            .encode("utf-8"))
                         methNamesSig = \
                             ", ".join(
                                 [bytes(n).decode() for n in parameterNames])
--- a/QScintilla/QsciScintillaCompat.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/QScintilla/QsciScintillaCompat.py	Sat Jul 25 12:58:42 2015 +0200
@@ -142,7 +142,7 @@
         except AttributeError:
             rangeHigh = list(range(40, 128))
         
-        f = font.family().encode()
+        f = font.family().encode("utf-8")
         ps = font.pointSize()
         weight = -font.weight()
         italic = font.italic()
--- a/Utilities/crypto/__init__.py	Fri Jul 24 18:44:45 2015 +0200
+++ b/Utilities/crypto/__init__.py	Sat Jul 25 12:58:42 2015 +0200
@@ -280,9 +280,9 @@
         cipher = encryptData(key, data)
     except ValueError:
         return b"", False
-    return CryptoMarker.encode() + Delimiter.encode().join([
-        digestname.encode(),
-        str(iterations).encode(),
+    return CryptoMarker.encode("utf-8") + Delimiter.encode("utf-8").join([
+        digestname.encode("utf-8"),
+        str(iterations).encode("utf-8"),
         base64.b64encode(salt),
         base64.b64encode(cipher)
     ]), True
@@ -299,13 +299,13 @@
     @return decrypted data (bytes) and flag indicating
         success (boolean)
     """
-    if not edata.startswith(CryptoMarker.encode()):
+    if not edata.startswith(CryptoMarker.encode("utf-8")):
         return edata, False  # it was not encoded using dataEncrypt
     
     from .py3AES import decryptData
     from .py3PBKDF2 import rehashPassword
     
-    hashParametersBytes, edata = edata[3:].rsplit(Delimiter.encode(), 1)
+    hashParametersBytes, edata = edata[3:].rsplit(Delimiter.encode("utf-8"), 1)
     hashParameters = hashParametersBytes.decode()
     try:
         # recreate the key used to encrypt

eric ide

mercurial