Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'encoding': 0.05; 'practice,': 0.07; 'subject:file': 0.07; 'currently,': 0.09; 'prefix': 0.09; 'api': 0.11; "wouldn't": 0.14; 'caches': 0.16; 'encoding.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'mapped': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'naming': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'artist': 0.24; 'header:In- Reply-To:1': 0.27; 'andrew': 0.30; 'characters': 0.30; 'file': 0.32; 'run': 0.32; 'another': 0.32; "i'd": 0.34; 'there': 0.35; 'really': 0.36; '(e.g.,': 0.36; 'easily': 0.37; 'problems': 0.38; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'most': 0.60; "you'll": 0.62; 'name': 0.63; 'such': 0.63; 'map': 0.64; 'different': 0.65; 'forward': 0.65; 'occur': 0.65; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'strategies': 0.77; 'conflicts': 0.84; 'reply- to:addr:python.org': 0.84; 'subject:Making': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=TZ6v63gh c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=7AxPfEIvyrUA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=NUPlrhJ5yyMA:10 a=Mzk0J34DFnONCBbATqQA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Tue, 07 May 2013 23:21:17 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Making safe file names References: <51895D03.4000300@gmail.com> In-Reply-To: <51895D03.4000300@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367965284 news.xs4all.nl 15961 [2001:888:2000:d::a6]:36825 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44910 On 07/05/2013 20:58, Andrew Berg wrote: > Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However, > artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forward slashes). Are there any > recommended strategies for naming such files while avoiding conflicts (I wouldn't want to run into problems for an artist named C-A-T or > CAT, for example)? I'd like to make the files easily identifiable, and there really are no limits on what characters can be in an artist name. > Conflicts won't occur if: 1. All of the characters of the artist's name are mapped to an encoding. 2. Different characters map to different encodings. 3. No encoding is a prefix of another encoding. In practice, you'll be mapping most characters to themselves.