about summary refs log tree commit diff
path: root/filters
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-01-18 11:14:06 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-01-18 11:14:06 +0100
commitd3756bd7b00f9ad6adede3c7f956a25b22a2254a (patch)
tree4bbad846fa91d3d6fa6becd197eb405ce6574bde /filters
parentcache: don't check for match with no key (diff)
downloadcgit-pink-d3756bd7b00f9ad6adede3c7f956a25b22a2254a.tar.gz
cgit-pink-d3756bd7b00f9ad6adede3c7f956a25b22a2254a.zip
syntax-highlighting: always use utf-8 to avoid ascii codec issues
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/syntax-highlighting.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py
index b5d615e..1ca4108 100755
--- a/filters/syntax-highlighting.py
+++ b/filters/syntax-highlighting.py
@@ -21,6 +21,7 @@
 
 
 import sys
+import io
 from pygments import highlight
 from pygments.util import ClassNotFound
 from pygments.lexers import TextLexer
@@ -29,6 +30,8 @@ from pygments.lexers import guess_lexer_for_filename
 from pygments.formatters import HtmlFormatter
 
 
+sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
+sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
 data = sys.stdin.read()
 filename = sys.argv[1]
 formatter = HtmlFormatter(style='pastie')
='3' class='logmsg'> 2022-04-03Publish "Care"June McEnroe 2022-03-31Publish "Compassion"June McEnroe 2022-03-24Skip matches with ident chars on either sideJune McEnroe This fixes, for example, where the link gets placed on static regex_t regex(const char *pattern, int flags) in title.c. 2022-03-24Add The Invisible Life of Addie LaRueJune McEnroe So good, but so long. Reminded me of The Ten Thousand Doors of January at the beginning, and more of that N. K. Jemisin series about gods later. I like this interacting with gods and becoming something like one sort of thing. God, it took me a whole month (more?) to read and this is only my third book of the year :( I need some more novellas to read, but the other books I have from the library currently are also thick. 2022-03-22Source ~/.profile.local if it existsJune McEnroe 2022-03-18Publish "Addendum 2021"June McEnroe 2022-03-16Remove wcwidth portJune McEnroe DYLD_FORCE_FLAT_NAMESPACE no longer exists in macOS 12 so this approach doesn't work anymore. Moved to <https://git.causal.agency/jorts/tree/wcwidth> and compiled into <https://git.causal.agency/jorts/tree/ncurses>. 2022-03-16Remove -j4 from ./PlanJune McEnroe Plan learned to set this automatically! 2022-03-15Rewrite Linux install.sh for DebianJune McEnroe 2022-03-15Remove dashJune McEnroe