On Wed, 11 Oct 2017, at 09:57 AM, Gianguido SorĂ  wrote:
> 
> I'm writing a small utility which uses a strings.Replacer to process
> some substitutions in some strings; these strings contains UTF-8
> characters as well as emojis.> 
> Here you can find a playground with an example:
> https://play.golang.org/p/gdfZ_zGGiO> 
> As you can see from the playground, the occurrence of "2" has been
> replaced with the string "altered" into the emoji itself, even though
> the hex representation of it is not directly listed in the Replacer.> 
> What could I do to prevent this from happening?

At first glance this looks like a bug in strings.Replacer. If the string
you are replacing is a single byte character then NewReplacer uses a
byteStringReplacer which treats the target as a byte array. I  suggest
opening an issue here https://github.com/golang/go/issues
Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to