This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix UnicodeEncodeError when retrieving words from utf-8 encoded file
Summary: This commit fixes the issue #746 pybind11's `py::str` constructor [has a different behaviour](https://github.com/pybind/pybind11/blob/ccbe68b084806dece5863437a7dc93de20bd9b15/include/pybind11/pytypes.h#L930) between Python 2 and Python 3. When casting from C++ string to py::str, we should decode as utf-8, but we should also encode it back in order to construct `py::str` correctly. Reviewed By: EdouardGrave Differential Revision: D14783627 fbshipit-source-id: 8a7d4b16f42d6d892203cf3d72f144427008dd7f
- Loading branch information