Thread regex utf8 and umlaut (9 answers)
Opened by curupira at 2013-07-26 14:20

Gast curupira
 2013-07-26 14:20
#169154 #169154
hello,

I have a problem with with my regex changing umlauts and other special characters and need a little help. All code and system is UTF-8. I wrote a test-program now, which should change ö to oe and any éè to e:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl

$text="ö";

print "$text 2\n";

 $text =~ s/[éè]/e/g;

print "$text 3\n";

 $text =~ s/[öÖ]/oe/g;

print "$text 4\n";


the output looks like this:

Code: (dl )
1
2
3
4
5
/tmp$ ./umlautregex.pl 
ö 2
e� 3
eoe 4
/tmp$


what's wrong with it?

View full thread regex utf8 and umlaut