--- qtwebkit-5.212.0-alpha4/Source/WebCore/platform/network/create-http-header-name-table.orig	2020-03-04 09:16:37.000000000 -0800
+++ qtwebkit-5.212.0-alpha4/Source/WebCore/platform/network/create-http-header-name-table	2021-08-18 16:37:29.705107300 -0700
@@ -54,8 +54,8 @@
 
 http_header_names.sort()
 
-gperf_file = open('HTTPHeaderNames.gperf', 'w')
-gperf_file.write('''
+gperf_file = open('HTTPHeaderNames.gperf', 'wb')
+gperf_file.write(b'''
 %{
 /*
  * Copyright (C) 2014 Apple Inc. All rights reserved.
@@ -105,11 +105,11 @@
 ''')
 
 for http_header_name in http_header_names:
-    gperf_file.write('    { "%s", %u },\n' % (http_header_name, len(http_header_name)))
+    gperf_file.write(('    { "%s", %u },\n' % (http_header_name, len(http_header_name))).encode('ascii'))
 
-gperf_file.write('};\n\n')
+gperf_file.write(b'};\n\n')
 
-gperf_file.write('''
+gperf_file.write(b'''
 %}
 
 %language=C++
@@ -131,9 +131,9 @@
 ''')
 
 for http_header_name in http_header_names:
-    gperf_file.write('%s, HTTPHeaderName::%s\n' % (http_header_name, http_header_name_to_id[http_header_name]))
+    gperf_file.write(('%s, HTTPHeaderName::%s\n' % (http_header_name, http_header_name_to_id[http_header_name])).encode('ascii'))
 
-gperf_file.write('''%%
+gperf_file.write(b'''%%
 bool findHTTPHeaderName(StringView stringView, HTTPHeaderName& headerName)
 {
     unsigned length = stringView.length();
--- qtwebkit-5.212.0-alpha4/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py.orig	2020-03-04 09:16:37.000000000 -0800
+++ qtwebkit-5.212.0-alpha4/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py	2021-08-18 16:40:37.434628000 -0700
@@ -57,9 +57,9 @@
 def expand_ifdef_condition(condition):
     return condition.replace('(', '_').replace(')', '')
 
-output_file = open('SelectorPseudoClassAndCompatibilityElementMap.gperf', 'w')
+output_file = open('SelectorPseudoClassAndCompatibilityElementMap.gperf', 'wb')
 
-output_file.write("""
+output_file.write(b"""
 %{
 /*
  * Copyright (C) 2014 Apple Inc. All rights reserved.
@@ -151,20 +151,20 @@
     keyword_definition = line.split(',')
     if len(keyword_definition) == 1:
         keyword = keyword_definition[0].strip()
-        output_file.write('"%s", {%s, CSSSelector::PseudoElementUnknown}\n' % (keyword, enumerablePseudoType(keyword)))
+        output_file.write(('"%s", {%s, CSSSelector::PseudoElementUnknown}\n' % (keyword, enumerablePseudoType(keyword))).encode('ascii'))
     else:
-        output_file.write('"%s", {CSSSelector::%s, CSSSelector::%s}\n' % (keyword_definition[0].strip(), keyword_definition[1].strip(), keyword_definition[2].strip()))
+        output_file.write(('"%s", {CSSSelector::%s, CSSSelector::%s}\n' % (keyword_definition[0].strip(), keyword_definition[1].strip(), keyword_definition[2].strip())).encode('ascii'))
 
     longest_keyword = max(longest_keyword, len(keyword))
 
-output_file.write("""%%
+output_file.write(b"""%%
 
 static inline const SelectorPseudoClassOrCompatibilityPseudoElementEntry* parsePseudoClassAndCompatibilityElementString(const LChar* characters, unsigned length)
 {
     return SelectorPseudoClassAndCompatibilityElementMapHash::in_word_set(reinterpret_cast<const char*>(characters), length);
 }""")
 
-output_file.write("""
+output_file.write(("""
 
 static inline const SelectorPseudoClassOrCompatibilityPseudoElementEntry* parsePseudoClassAndCompatibilityElementString(const UChar* characters, unsigned length)
 {
@@ -182,9 +182,9 @@
     }
     return parsePseudoClassAndCompatibilityElementString(buffer, length);
 }
-""" % longest_keyword)
+""" % longest_keyword).encode('ascii'))
 
-output_file.write("""
+output_file.write(b"""
 PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const CSSParserString& pseudoTypeString)
 {
     const SelectorPseudoClassOrCompatibilityPseudoElementEntry* entry;
--- qtwebkit-5.212.0-alpha4/Source/WebCore/css/makeSelectorPseudoElementsMap.py.orig	2020-03-04 09:16:37.000000000 -0800
+++ qtwebkit-5.212.0-alpha4/Source/WebCore/css/makeSelectorPseudoElementsMap.py	2021-08-18 16:41:25.974582300 -0700
@@ -57,9 +57,9 @@
 def expand_ifdef_condition(condition):
     return condition.replace('(', '_').replace(')', '')
 
-output_file = open('SelectorPseudoElementTypeMap.gperf', 'w')
+output_file = open('SelectorPseudoElementTypeMap.gperf', 'wb')
 
-output_file.write("""
+output_file.write(b"""
 %{
 /*
  * Copyright (C) 2014 Apple Inc. All rights reserved.
@@ -153,10 +153,10 @@
         keyword = keyword_definition[0].strip()
         pseudo_element_enum_value = "CSSSelector::" + keyword_definition[1].strip()
 
-    output_file.write('"%s", %s\n' % (keyword, pseudo_element_enum_value))
+    output_file.write(('"%s", %s\n' % (keyword, pseudo_element_enum_value)).encode('ascii'))
     longest_keyword = max(longest_keyword, len(keyword))
 
-output_file.write("""%%
+output_file.write(b"""%%
 
 static inline CSSSelector::PseudoElementType parsePseudoElementString(const LChar* characters, unsigned length)
 {
@@ -165,7 +165,7 @@
     return CSSSelector::PseudoElementUnknown;
 }""")
 
-output_file.write("""
+output_file.write(("""
 
 static inline CSSSelector::PseudoElementType parsePseudoElementString(const UChar* characters, unsigned length)
 {
@@ -183,9 +183,9 @@
     }
     return parsePseudoElementString(buffer, length);
 }
-""" % longest_keyword)
+""" % longest_keyword).encode('ascii'))
 
-output_file.write("""
+output_file.write(b"""
 CSSSelector::PseudoElementType parsePseudoElementString(const StringImpl& pseudoTypeString)
 {
     if (pseudoTypeString.is8Bit())
