Thanks.

Though I understand what is happening, I wondered if Go includes ways to 
handle such text at the grapheme level? I only see libraries aimed at the 
code point level.

On Wednesday, 6 July 2016 15:59:30 UTC+1, Rob 'Commander' Pike wrote:
>
> Here it is without the combining character: 
> https://play.golang.org/p/1bgIkIbFei
>
> Ranging over a string iterates the code points within. For...range is 
> unaware of combining characters; they are a higher-level concept.
>
> The package described at https://godoc.org/golang.org/x/text/unicode/norm 
> might be of interest.
>
> -rob
>
>
>
>
> On Wed, Jul 6, 2016 at 7:48 AM, Egon <egon...@gmail.com <javascript:>> 
> wrote:
>
>>
>>
>> On Wednesday, 6 July 2016 17:31:06 UTC+3, gary.wi...@victoriaplumb.com 
>> wrote:
>>>
>>> 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?
>>>
>>
>> I'm not an expert in this area, but combing characters belong to mark 
>> category: https://play.golang.org/p/2X8xc9sijY
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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