Il giorno mercoledì 6 luglio 2016 16:31:06 UTC+2, 
gary.wi...@victoriaplumb.com ha scritto:
>
> I have a little snippet here which iterates over a string.
>
> package main
>
> import "fmt"
>
> func main() {
>
> text := "Noël"
>
> for _, rune_ := range text {
> fmt.Printf("%#U\n", rune_)
> }
> }
>
> Playground: https://play.golang.org/p/bVfXB2crKo
>
> The output is not correct because it breaks the 'e' from the diaeresis '
> *¨*'.
>
> Without normalisation (because it doesn't work with all code points), is 
> there any way of iterating over this string by grapheme to output each as a 
> fully formed readable character?
>

Probably you want to use Unicode text 
segmentation: http://unicode.org/reports/tr29/.
The report defines an algorithm for finding grapheme cluster boundaries.

Unfortunately it is not available in the golang.x/text package.


Manlio

-- 
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