Hi everyone, long time lurker here. Even longer Ruby user.

I have a minor problem with a utf8 string.

In short I see this behavior:

"Stuhlu".sub(/u/,')
=> "Stlu"
"Stuhlu".reverse.sub(/u/,').reverse
=> "Stuhl\274\303"
"Stuhlu".reverse.sub(/u/,').split(//).reverse.join
=> "Stuhl

The general goal is to sub the final "u" in that word with an  
umlauted version and not the first. I started irb with -Ku so that I  
get utf8 support in all things ruby. But the behavior of reverse on  
the substituted string is really baffling me.

Does anyone know the reason for the weirdness of reverse after the  
sub? The last version was a hack to get things to just work. Am I  
mising a Regexp option that would make the final match work? I don't  
normally look for a final match to substitute on. And reverse seemed  
the most logical choice for a solution.

Any help would be appreciated!

Thanks,
Mitch