Skip to content

StringIndexError when trying to create a StringDocument based on a UTF8 string #255

@alexzandros

Description

@alexzandros

I'm trying to create a StringDocument based on a string that contains utf-8 characters, and all i'm getting is a StringIndexError

My code is as follows

str = "Lo que tengamos que hacer, apoyar, enteegar el ❤️ y el alma por nuestro país. Ivan es el Man. 👏👏👏#Duquepresidente https://t.co/Dr1LdTa5yQ"
sd = StringDocument(str)

And I get the following error

Error showing value of type StringDocument{String}:
ERROR: StringIndexError: invalid index [50], valid nearby indices [48]=>'❤', [51]=>'️'

Followed by a stack trace.

So, I need to know what is the best practice for working with utf strings.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions