Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError when using less -R #84

Open
while0pass opened this issue Nov 23, 2016 · 1 comment
Open

UnicodeEncodeError when using less -R #84

while0pass opened this issue Nov 23, 2016 · 1 comment
Labels

Comments

@while0pass
Copy link
Contributor

while0pass commented Nov 23, 2016

I get an UnicodeEncodeError when I use colout with less -R. When I use less without options or just don't use less at all, everything goes fine:

$ cat svn-diff.txt | colout -s diff | less
$ cat svn-diff.txt | colout -s diff

But if I add -R option so that ascii escape sequences wouldn't be striped, I get this:

$ cat svn-diff.txt | colout -s diff | less -R

Index: generate_fountain.py
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/colout/colout.py", line 862, in <module>
    write_all( as_all, sys.stdin, sys.stdout, highlight, lexer, formatter )
  File "/usr/local/lib/python2.7/dist-packages/colout/colout.py", line 729, in write_all
    map_write( stream_in, stream_out, function, *args )
  File "/usr/local/lib/python2.7/dist-packages/colout/colout.py", line 574, in map_write
    write( function(item, *args), stream_out )
  File "/usr/local/lib/python2.7/dist-packages/colout/colout.py", line 545, in write
    stream.write(colored)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0412' in position 16: ordinal not in range(128)
===================================================================
--- generate_fountain.py        (revision 1294)
+++ generate_fountain.py        (working copy)
@@ -5,7 +5,7 @@

svn-diff.txt contains several non-ascii characters.

@nojhan
Copy link
Owner

nojhan commented Feb 26, 2018

Most probably related to #85, fixed by e9f0bff, please check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants