getting correct string length when it includes apostrophe character \xe2\x80\x99

Engaged ,
Feb 01, 2021

Copy link to clipboard

Copied

I have a plugin that replaces portions of text using text runs and ranges. I'm running into problems with strings with characters like a curled apostrophe because it's stored as "\xe2\x80\x99" so I can't get an accurate string length. I understand special characters like en dashes and thin spaces pose a similar problem.

 

The plugin is given a vector of UTF-8 std::strings to replace chunks of text in existing text objects. If a string is "Joe’s" then std::string::length returns 7, not 5, and I allocate two characters too many for that block of text.

 

Does the SDK provide a means of obtaining the correct character count or string length?

TOPICS
SDK

Views

29

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Have something to add?

Join the conversation