Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Bad accent causes problem

From: SunandaDH:aol at: 11-Oct-2003 10:06

Patrick:
> Publishing photos on Internet, I got problems with filename with > accent. For example, a photo named "Ebouriffée.jpg" displays well under > Windows, but give me an "HTTP error 404" under Linux.
Getting universally-acceptable files names takes a little care. REBOL.org, for example accepts script contributions whose names are (I think this is the full set of rules): -- made up only of lowercase unaccented letters, hyphens, digits, and periods (".") -- First and last cannot be hyphens or periods -- First cannot be a digit -- Maximum of one period Those rules are a little restricted (no spaces or "$" or "#" etc), but they should stand the test of time.....Though we probably need to think about a maximum file name length. Here's a function to convert accented letters. You might want to edit 'replacements to replace accents with digraphs or other multi-letter combinations. ===== deaccent: func [file-name [file!] /local accents replacements ] [ accents: ["à" "é" "è" "ï" "ô" "ù" "ç"] replacements: ["a" "e" "e" "i" "o" "u" "c"] lowercase file-name foreach accent accents [replace/all file-name accent pick replacements index? find accents accent] ] ;; func print ["before " f] f: %Ebouriffée-àéèïôùç-àéèïôùç.jpg deaccent f print ["after " f] ===== Sunanda.