kcoyner / rpl

intelligent recursive search/replace utility
GNU General Public License v2.0
14 stars 13 forks source link

UnicodeEncodeError on Python 2 #4

Open homeworkprod opened 7 years ago

homeworkprod commented 7 years ago

rpl 1.5.7 on Python 2 trips over some Unicode characters:

Processing:  /usr/lib/python3.4/site-packages/ipython_genutils/tests/test_path.py
Traceback (most recent call last):
  File "rpl", line 314, in <module>
    main()
  File "rpl", line 246, in main
    matches = blockrepl(f, o, regex, old_str, new_str, 1024)
  File "rpl", line 93, in blockrepl
    outstream.write(parts)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2202' in position 559: ordinal not in range(128)

The IPython test contains the literals u'∂ir' and u'ƒile'.

JoshuaFern commented 4 years ago

I believe I've encountered this issue, or something similar. Unicode characters near the replaced strings are being deleted.

See: https://github.com/dreamer/dosbox-staging/pull/197 Running this version: https://github.com/NixOS/nixpkgs/blob/3d6cdfa24bd771b36e8c87241d17275dd144c7a3/pkgs/tools/text/rpl/default.nix