Skip to content

Jira string truncation does not take into account UTF-8 encodingΒ #1135

@alexcottner

Description

@alexcottner

Jira uses UTF-8 encoding for unicode characters. This means that some characters will take up multiple characters of space in the string. For example, πŸ€ is considered 2 characters as it takes 4 bytes. With the current spec, it seems possible for some to take up 6 bytes which should be 3 characters? Although I couldn't find any examples of this.

We should adjust our string truncation to take this into account. I'm hoping there is some standard string encoding functiosn we can use to adjust this.

if max_length > 0 and len(jira_output) > max_length:
# Truncate on last word.
jira_output = jira_output[:max_length].rsplit(maxsplit=1)[0]

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