From dev-return-53892-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Fri Nov 30 14:42:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 173E7180671 for ; Fri, 30 Nov 2018 14:42:03 +0100 (CET) Received: (qmail 45556 invoked by uid 500); 30 Nov 2018 13:42:03 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 45545 invoked by uid 99); 30 Nov 2018 13:42:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2018 13:42:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id CB16218304F for ; Fri, 30 Nov 2018 13:42:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.801 X-Spam-Level: X-Spam-Status: No, score=-109.801 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_NUMSUBJECT=0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id TlD49DbT9ZzC for ; Fri, 30 Nov 2018 13:42:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 1B73160E35 for ; Fri, 30 Nov 2018 13:42:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 54B52E00D4 for ; Fri, 30 Nov 2018 13:42:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 14E9724DCE for ; Fri, 30 Nov 2018 13:42:00 +0000 (UTC) Date: Fri, 30 Nov 2018 13:42:00 +0000 (UTC) From: "Jarry Shaw (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (THRIFT-4677) UnicodeDecodeError in Python3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Jarry Shaw created THRIFT-4677: ---------------------------------- Summary: UnicodeDecodeError in Python3 Key: THRIFT-4677 URL: https://issues.apache.org/jira/browse/THRIFT-4677 Project: Thrift Issue Type: Bug Components: Python - Library Environment: Operating System: Windows 10 Pro (Simplified Chinese) Python Interpreter: Python 3.6.6 {{osquery}}=C2=A0Version: 3.3.0 {{osquery-python}} Version:=C2=A03.0.5 =C2=A0 Reporter: Jarry Shaw Attachments: compat.py This is an issue occurred when using [osquery-python|https://github.com/osq= uery/osquery-python] (Python binding of [osquery|https://osquery.io/] by Fa= cebook). When querying, {{UnicodeDecodeError}} raised with error message: "{{'utf-8'= codec can't decode byte 0xc3 in position 0: invalid continuation byte}}" f= rom {{thrift.compat.binary_to_str}}, which is because the encoding of {{bin= _val}} parameter should be "{{gbk}}". Possible approaches are: * add a parameter for user to determine encodings * get the system encoding through {{locale.getpreferredencoding()}} * call {{bin_val.decode}} with {{errors=3D'replace'}} or {{errors=3D'ignor= e'}} parameter * introduce {{chardet}} to try and resolve encoding problems The attachment is my hack solution to this issue (through not perfect). -- This message was sent by Atlassian JIRA (v7.6.3#76005)