Re: Problem with swedish letters

Gunnar Heikkilä <[email protected]>
Newsgroups gmane.comp.web.pixory
Message-ID <[email protected]>
> good catch. How about '-' (dash)? I'm not crazy about the idea of
> using a regular alphabetical character (X) for the replacement.

Dash should work OK as far as I know. I do agree that it is better
with a non-character replacement.

> Any hints? If you could provide a skeleton of the algorithm, or if
you
> can point me to an open source java library that implements this
> mapping, I can attempt to include the feature. Otherwise, it will
have
> to wait for later versions

I don't know anything about Java, but I was thinking of something like
an index vector with the same length as the latin-1 charset (i.e.
0..255). Pseude code below (with "indentation underscore" so that
Yahoo does not screw up my indentation...):

# Initialize vector somewhere in your code
# Fill vector with "dash"
for c = 0..255
___vector[c] = '-'
endfor

# Fill in "accepted characters" in vector
for c = ascii 46, 48..57, 65..90, 95, 97..122
___vector[c] = c
endfor

# Fill in look-alikes
c[192..198] = 'A'
c[199] = 'C'
c[200..203] = 'E'
c[204..207] = 'I'
c[208} = 'D'
c[209] = 'N'
c[210..214, 216] = 'O'
c[217..220] = 'U'
c[221] = 'Y'
c[223] = 'B'
c[224..230] = 'a'
c[231] = 'c'
c[232..235] = 'e'
c[236..239] = 'i'
c[240] = 'd'
c[241] = 'n'
c[242..246, 248] = 'o'
c[249..252] = 'u'
c[253, 255] = 'y'

# Then just use the vector when translation is needed
for each character c in a filename
___if c is not latin-1 then
______c = '-'
___else
______c = vector[c]
___endif
endfor

I guess that you have access to a Latin-1 table, otherwise you can
take a look at e.g. 
http://www.houseofmabel.com/programs/html3/docs/iso-1.html

/Gunnar




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/pixory-beta/

<*> To unsubscribe from this group, send an email to:
     [email protected]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.