Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: about special characters Date: Sat, 30 Apr 2016 15:36:06 -0400 Lines: 28 Message-ID: References: <572403de$0$1601$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de HIoh5CVXkNS1X22+oGp45Q1Dajkw8y/qeeaWacWZ5SiA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'versions,': 0.05; 'filename': 0.07; 'filenames': 0.07; 'strings.': 0.07; 'encoding.': 0.09; 'filename,': 0.09; 'patches': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:characters': 0.09; 'python': 0.10; 'jan': 0.11; '2.7': 0.13; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'later': 0.16; 'byte': 0.18; 'version.': 0.18; 'windows': 0.20; 'not,': 0.22; '3.x': 0.22; 'problem:': 0.22; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'strings,': 0.29; 'windows,': 0.29; 'fixed': 0.31; 'good.': 0.32; 'run': 0.33; 'file': 0.34; 'text': 0.35; 'instance': 0.35; 'path': 0.35; 'unicode': 0.35; 'but': 0.36; 'there': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'seem': 0.37; 'delete': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60; 'skip:n 10': 0.62; 'received:96': 0.63; 'here': 0.66; '3.4': 0.84; 'believe,': 0.84; 'greek': 0.84; 'stored,': 0.84; 'received:fios.verizon.net': 0.91; 'asian': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <572403de$0$1601$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:107921 On 4/30/2016 2:13 PM, Jianling Fan wrote: > I am using python 2.7 in Windows 7 Enterprise version. > > Here is the the filename that cause the problem: "Decock-2013-On the > potential of =CE=B418O and =CE=B415N.pdf" > When I delete the "=CE=B4" in the filename, the script works good. You may be able to get "=CE=B4" (and other Greek characters) to work on y= our=20 system with 2.7, but if you want to be able to work with any filename on = Windows, get Python 3.4 or later and use text strings, not byte strings. = You may someday run into a Name-your-title.pdf file name with other=20 'strange' characters from other Windows filenames are unicode strings and are stored, I believe, with=20 utf-16 encoding. Even in early 3.x versions, there were Windows path=20 problems, for instance with east Asian characters. Multiple 3.x patches = seem to have fixed the problems. So merely using unicode is not, in=20 general, sufficient. --=20 Terry Jan Reedy