Bad accent causes problem
[1/14] from: patrick::philipot::laposte::net at: 11-Oct-2003 10:25
Hi List,
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.
I thought I could rename the file using lowercase or uppercase or even
a combinaison of the two, but I can't.
>> f: %Ebouriffée.jpg
== %Ebouriffée.jpg
>> lowercase f
== %ebouriffée.jpg
>> uppercase f
== %EBOURIFFÉE.JPG
>> lowercase uppercase f
== %ebouriffée.jpg
Do I have to write a function to handle those "àéèïôùç" or is there
some trick out there?
Regards
Patrick
[2/14] 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.
[3/14] from: patrick:philipot:laposte at: 11-Oct-2003 18:21
Thank you Sunanda,
I will use your function.
--
Best regards,
Patrick
[4/14] from: carlos:lorenz:bol at: 12-Oct-2003 16:37
Hi Sunanda e others,
This thread reminded me that some time ago I have asked some
help with foreign characters that are not echoed in REBOL/View
fields and up to know I have not find any solution.
I have also put some feedback to RT but it seems they are with lots
of other things to do
I use Debian Linux and KDE 3.1 e everything works fine but REBOL/View
Do you think REBOL uses it own keyboard character maps? Is there any
hack to be made? I can't enter words Portuguese words in text fields such as
coração
(heart) or "pé " (foot) they are echoed as coraç~ao and p'e :(
Thanks
Carlos
[5/14] from: ingo:2b1 at: 12-Oct-2003 22:37
Hi Carlos,
Carlos Lorenz wrote:
> Hi Sunanda e others,
> This thread reminded me that some time ago I have asked some
<<quoted lines omitted: 6>>
> hack to be made? I can't enter words Portuguese words in text fields such as
> "coração" (heart) or "pé " (foot) they are echoed as coraç~ao and p'e :(
Not that I can be of much help, but for me it seems, that the keyboard
handling is the culprit, I can copy á and à into an area, but I can't type
it in during the keyboard (I'd have to use keyboard composition). On the
other hand, german special characters öäü, which are on their special keys
work fine.
Don't know if this'll help, though,
Ingo
[6/14] from: SunandaDH:aol at: 13-Oct-2003 5:58
Carlos:
> Do you think REBOL uses it own keyboard character maps? Is there any
> hack to be made? I can't enter words Portuguese words in text fields such
as
> "coração" (heart) or "pé " (foot) they are echoed as coraç~ao and p'e :(
Like Ingo, I can't help you on this. You can see all the characters that
REBOL supports on your system by running this View script:
=====
rebol []
hex-lo: copy [across banner "ASCII Chart" return box 25x25 red "\"]
hex-chars: "0123456789ABCDEF"
for n 1 16 1
[ append hex-lo [box 25x25 green]
append hex-lo form hex-chars/:n
]
append hex-lo 'return
for hn 0 15 1
[ append hex-lo [box 25x25 green]
append hex-lo form pick hex-chars (hn + 1)
for ln 0 15 1
[append hex-lo [box 25x25 blue]
append hex-lo form (to-char 16 * hn + ln)
]
append hex-lo 'return
]
unview/all
view layout hex-lo
=====
But I don't know any way of hacking the keyboard scheme (if there is such a
thing) to input extended characters,
Sorry!
Sunanda.
[7/14] from: didec:tiscali at: 13-Oct-2003 13:07
Re: Bad accent causes problem
Not sure it's the key, but may be :
When you typed in field/area, you call (from the engage) the ctx-text/edit-text func.
This one filter the allowed characters with this line :
if char? key [
either find keys-to-insert key [insert-char face key] [key: select keymap key]
]
with :
keys-to-insert: make bitset! #{
01000000FFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
}
and :
keymap: [
#"^H" back-char
#"^-" tab-char
#"^~" del-char
#"^M" enter
#"^A" all-text
#"^C" copy-text
#"^X" cut-text
#"^V" paste-text
#"^T" clear-tail
]
Perhaps changing the bitset can be a solution, but it depends if you type the character
with one or 2 keys.
Another issue might be the terminal type that is declare in your config file. Can you
use this chars in a terminal window ?
DideC
[8/14] from: carlos:lorenz:bol at: 13-Oct-2003 8:21
Hello
Em Seg 13 Out 2003 09:07, Didec escreveu:
> Re: Bad accent causes problem
> Not sure it's the key, but may be :
>
> Another issue might be the terminal type that is declare in your config
> file. Can you use this chars in a terminal window ?
>
> DideC
I can type "ã", "é", "ü" with no problem in REBOL console but in REBOL/View I
can't
Carlos
[9/14] from: carlos:lorenz:bol at: 13-Oct-2003 8:22
Thanks anyway Sunanda
Em Seg 13 Out 2003 07:58, [SunandaDH--aol--com] escreveu:
[10/14] from: carlos:lorenz:bol at: 13-Oct-2003 8:23
Ingo
> other hand, german special characters öäü, which are on their special keys
> work fine.
>
> Don't know if this'll help, though,
>
> Ingo
you mean german special characters work fine in REBOL/View?
Carlos
[11/14] from: rotenca:telvia:it at: 13-Oct-2003 15:04
Hi all,
> keys-to-insert: make bitset! #{
> 01000000FFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> }
>
> Perhaps changing the bitset can be a solution, but it depends if you type
the character with one or 2 keys.
This bitset excludes only first control chars in the range 0-31 and 127.
If you want to see the chars permitted by this View bitset, do
monitor ctx-text
and then double click on the item keys-to-insert. In this ways you can also
see all the chars in the keymap.
(you need anamonitor.r from http://www.rebol.it/~romano/)
---
Ciao
Romano
[12/14] from: ingo:2b1 at: 13-Oct-2003 20:42
Hi Carlos,
Carlos Lorenz wrote:
> Ingo
>
>>other hand, german special characters öäü, which are on their special keys
>>work fine.
<...>
> you mean german special characters work fine in REBOL/View?
>
> Carlos
Yup,
I can type german special characters (which have there own keys), but no
other accented characters (which I type using composing).
On the other hand, copying special characters over the clipboard, works.
Guess we'll have to find one of the /View gurus to drill into the keyboard
handling stuff ;-)
Ingo
[13/14] from: carlos::lorenz::bol::com::br at: 13-Oct-2003 17:18
REBOL/View lack of i18n :(
Ingo and others,
Really strange this behaviour of /View . Is this some lack of i18n?
In fact special characters can only be entered in fields by copying & pasting
nod directly via keyboard.
I wonder french and spanish people beside the german pals
at this list have same troubles under Linux.
The thing is is RT aware of the problem?
Carlos
Em Seg 13 Out 2003 16:42, Ingo Hohmann escreveu:
[14/14] from: andrew:martin:colenso:school at: 24-Dec-2003 22:40
FW: Re: Bad accent causes problem
Hi Norman,
R> What im trying to accomplish is to reverse a bitset!
R> Or better.. to extract to complete contence from a bitset!
G> I think Brett(?) had a module that did that, but I'm not sure where
it
G> is. I might have it here somewhere if nobody else knows.
Perhaps Romano's email from earlier might be helpful?
Andrew J Martin
Attendance Officer
& Grail Jedi.
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted