pass encoding to uses of decode() incase the default isnt utf-8. ignore decode errors...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 17 Nov 2011 04:05:54 +0000 (04:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 17 Nov 2011 04:05:54 +0000 (04:05 +0000)
This should fix an error with generated qtcreator projects.

also replace decoded bytes for unicode escape sequences in the VIEW3D_MT_edit_text_chars menu.

build_files/cmake/project_info.py
build_files/cmake/project_source_info.py
doc/manpage/blender.1.py
doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_ui/space_view3d.py

index 0b922979a63bbe05738c327b7f82cb46d0a4ad52..7162b324f944b3f355bdf9afbb2436a9f366957e 100755 (executable)
@@ -224,7 +224,9 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
 
     import subprocess
     info = subprocess.Popen(["svn", "info", path],
-                            stdout=subprocess.PIPE).communicate()[0].decode()
+                            stdout=subprocess.PIPE).communicate()[0]
+    # string version, we only want the URL
+    info = info.decode(encoding="utf-8", errors="ignore")
 
     for l in info.split("\n"):
         l = l.strip()
index 5d646eea2c1c1a5fb22393606dbe9f7315622f7d..d4b48ccd859871ece6efc3ddffe2e8acfed82f51 100644 (file)
@@ -73,7 +73,7 @@ def do_ignore(filepath, ignore_prefix_list):
 def makefile_log():
     import subprocess
     import time
-    # Check blender is not 2.5x until it supports playback again
+
     print("running make with --dry-run ...")
     process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
                                 stdout=subprocess.PIPE,
@@ -85,7 +85,7 @@ def makefile_log():
     out = process.stdout.read()
     process.stdout.close()
     print("done!", len(out), "bytes")
-    return out.decode("ascii").split("\n")
+    return out.decode("utf-8", errors="ignore").split("\n")
 
 
 def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
index 21df42a4082bfb21f3fff8314b5dd4f015bec66d..0d43daccc5e9b40ec14cea9df61ccefd257aca65 100644 (file)
@@ -52,9 +52,9 @@ else:
 
 cmd = [blender_bin, "--help"]
 print("  executing:", " ".join(cmd))
-blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode()
+blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8")
 
-blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip()
+blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8").strip()
 blender_version = blender_version.split("Build")[0]
 
 date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")
index 9cbd6824bbb34842a9541fd826caf2aafd31dcb8..fc17b9a24a5ce7d9d1479d7af911dc90c72152fd 100644 (file)
@@ -658,7 +658,7 @@ def pycontext2sphinx(BASEPATH):
         char_array = c_char_p_p.from_address(attr)
         i = 0
         while char_array[i] is not None:
-            member = ctypes.string_at(char_array[i]).decode()
+            member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
             fw(".. data:: %s\n\n" % member)
             member_type, is_seq = type_map[member]
             fw("   :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
index 6bf8dd82c9bce09e028be4555470b65cff133d47..a2a4405f77a63cdd48455ee582e3b87bcf907a17 100644 (file)
@@ -1830,32 +1830,32 @@ class VIEW3D_MT_edit_text_chars(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
-        layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
+        layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00A9"
+        layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = "\u00AE"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
-        layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
-        layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
-        layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
-        layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
-        layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
-        layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
-        layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
-        layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
+        layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u00B0"
+        layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = "\u00D7"
+        layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A"
+        layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "\u00B9"
+        layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "\u00B2"
+        layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "\u00B3"
+        layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00BB"
+        layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00AB"
+        layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2030"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
-        layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
-        layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
+        layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\u00A4"
+        layout.operator("font.text_insert", text="British Pound|Alt L").text = "\u00A3"
+        layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\u00A5"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
-        layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
-        layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
+        layout.operator("font.text_insert", text="German S|Alt S").text = "\u00DF"
+        layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = "\u00BF"
+        layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = "\u00A1"
 
 
 class VIEW3D_MT_edit_meta(Menu):