Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!hq-usenetpeers.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'interpreter': 0.04; 'raises': 0.07; 'sys,': 0.07; 'broken.': 0.09; 'codecs': 0.09; 'subject:using': 0.09; 'decode': 0.16; 'failed.': 0.16; 'korean.': 0.16; 'subject:String': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'os,': 0.22; 'tried': 0.25; 'header:In- Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.29; "skip:' 10": 0.30; 'error': 0.30; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'pm,': 0.35; 'sometimes': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'modules': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'show': 0.63; 'subject:there': 0.65; 'subject:any': 0.84 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=JRB6NuK+NP6bYqMRzf7hglLGwrTJL56YJKWPTTx3wIM=; b=N7PkWzxVv43itTwNTAn4EwV9hOWUBGcBsXQC79SLfKnisOEyT8nnu4/2ASNq2r3qTY zU+vohfKDEzWNr657vRXnjLugdZ/DWygxbJZhvwKTuDv4XljnqTpQmlbz5YbgVZF+gRQ 1CmB0DesjZjHt/hMHcK6zYhmzZFKXbw3nl3b6n1ChT0L93197fiffhvtaq4AGasKRvUc gZcQ3rcqc06911nuvUNTUs/p1VJCXZUu1Ko1S6XLIMZAA0Fb3barlg3D7GpUbAP23DO6 SOtmO66DYjW8aipmMUIhRR0anI6EhPULXQv97ZzG702gneWAbuOe6FMwg66jFvhBk87G lcvg== MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 27 Jun 2012 19:20:28 -0700 Subject: Re: Is there any way to decode String using unknown codec? From: Benjamin Kaplan To: python-list@python.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQk+crwY9zPAHPOUqusKeacrerL7Ltjvh+JU9nKIvJ2S49b8h9il/ytk95MEBEwL0L/paTNq X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1340850037 news.xs4all.nl 6861 [2001:888:2000:d::a6]:46397 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24574 On Wed, Jun 27, 2012 at 6:14 PM, wrote: > Hi > I'm a Korean and when I use modules like sys, os, &c, > sometimes the interpreter show me broken strings like > '\x13\xb3\x12\xc8'. > It mustbe the Korean "alphabet" but I can't decode it to the rightway. > I tried to decode it using codecs like cp949,mbcs,utf-8 > but It failed. > The only way I found is eval('\x13\xb3\x12\xc8'). > It raises an Error with showing right Korean. > Is there any way to deal it being not broken? > -- It's not broken. You're just using the wrong encodings. Try utf-16le.