Forum Moderators: coopster & phranque

Message Too Old, No Replies

Regexp Question/ advice needed

Regexp

         

Perllover

1:37 pm on Mar 18, 2010 (gmt 0)

10+ Year Member



I made a regexp rule because Catalyst has some difficulties with uft8 and ISO etc.

It converts Ä ä Ö ö Ü ü ß to: Ä ä Ö ö Ü ü ß on sending a form.

There is no way of decode so I wrote this rule:

$string =~ tr/[Ä,ä,Ö,ö,Ü,ü,ß]/[¤Ä,¤ä,¤Ö,¤ö,¤Ü,¤ü,¤ß]/; $string =~ s/¤//g;

But can anyone tell me is there is a simpler regexp?

Greetings from the Duch mountains,

Marco-Paul Breijer

janharders

3:15 pm on Mar 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you could use something like
%replacethis = ('"' => 'Ä', '¤' => 'ä'); # ... $string =~ s/Ã(.)/$replacethis{ $1 }/egis;

to make it easier to maintain and read, but I doubt that it'll be quicker.
On the other hand, have you checked that it's really a bug?
I hate charsets because I often end up going the trial and error-route to make browser, script and database work side by side, but it'd be a surprise if Catalyst couldn't handle that. Does it set accept-charset on the form in question?