Bug in regsub with "special chars"?

mof

[regsub -all {[s]} "s" "a" new_str]

substitutes to 1, whereas

[regsub -all {[ß]} "groß" "a" new_str]

substitutes to 2.

I guess it's some encoding stuff, as äöü trigger this, too. But I don't know how tcl handles special encodings.


MG For me, both regsub calls return 1 as expected, with Tcl 8.5.7.


mof Solution: It really was an encoding thing. As tcl uses unicode internally, strings inside the source code have to be transformed manually if the source files are saved in a different encoding (which is utf-8 in my case). Given the example above, assuming that "groß" would come from a user input (therefore already being unicode), I would use

[regsub -all {[\u00DF]} "groß" "a" new_str]

instead.