[OSM-dev] perl and special utf-8 characters

Gary68 gary at gary68.de
Fri Mar 11 14:11:50 GMT 2011


i want to find out if certain characters (german umlaute) are contained
in a string that i work char by char.

	my $text = "abc äöü" ;
	my $out = "" ;
	@chars = split //, $text ;

	foreach my $c (@chars) {
		# here a condition is needed ! 
		if ( $c eq <umlaut> ) {
			$out .= $c ;

unfortunately the umlaute are represented as two bytes - or whatever is
the correct term here.

i do have the codes for chr(0xXXXX) but don't know what to compare them

is there someone who could spend 3 lines of code. probably some encode
and decode is needed...

thanks a lot !


More information about the dev mailing list