[PATCH] D133236: [clang-format] Use utf-8 for JSON object load

Luke Drummond via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 5 07:41:28 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f4e6cfe73d8: [clang-format] Use utf-8 for JSON object load (authored by kaitingwang, committed by ldrumm).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133236/new/

https://reviews.llvm.org/D133236

Files:
  clang/tools/clang-format/clang-format.py


Index: clang/tools/clang-format/clang-format.py
===================================================================
--- clang/tools/clang-format/clang-format.py
+++ clang/tools/clang-format/clang-format.py
@@ -10,9 +10,9 @@
 #     imap <C-I> <c-o>:py3f <path-to-this-file>/clang-format.py<cr>
 #   endif
 #
-# The if-elseif-endif conditional should pick either the python3 or python2 
+# The if-elseif-endif conditional should pick either the python3 or python2
 # integration depending on your vim setup.
-# 
+#
 # The first mapping enables clang-format for NORMAL and VISUAL mode, the second
 # mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a different key (C-I stands for Ctrl+i).
@@ -134,7 +134,7 @@
     )
   else:
     header, content = stdout.split(b'\n', 1)
-    header = json.loads(header)
+    header = json.loads(header.decode('utf-8'))
     # Strip off the trailing newline (added above).
     # This maintains trailing empty lines present in the buffer if
     # the -lines specification requests them to remain unchanged.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133236.457997.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220905/32174ca7/attachment.bin>


More information about the cfe-commits mailing list