You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2020/06/22 20:51:45 UTC

[thrift] branch master updated: THRIFT-2087 Python compiler replace non utf-8 char with default Client: py Patch: Emmanuel Brard

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 2834101  THRIFT-2087 Python compiler replace non utf-8 char with default Client: py Patch: Emmanuel Brard
2834101 is described below

commit 283410126ccb3ac4990045e07cccb5df11ee2a16
Author: Emmanuel Brard <em...@getyourguide.com>
AuthorDate: Mon Jun 22 10:40:11 2020 +0200

    THRIFT-2087 Python compiler replace non utf-8 char with default
    Client: py
    Patch: Emmanuel Brard
    
    This closes #2184
---
 compiler/cpp/src/thrift/generate/t_py_generator.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 827c482..224ff6a 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -2230,7 +2230,7 @@ void t_py_generator::generate_deserialize_field(ostream& out,
         } else if(!gen_utf8strings_) {
           out << "readString()";
         } else {
-          out << "readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()";
+          out << "readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()";
         }
         break;
       case t_base_type::TYPE_BOOL: