Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: Truncate encoded string (OFBIZ-13167) #844

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

nmalin
Copy link
Contributor

@nmalin nmalin commented Nov 5, 2024

On model form, when you use a field description with a text size like :


<form...>
    <field name="myfield" ...><display size="10"/></field>
</form>

and your field myField contains a string with a special character like "my char é, so bad truncate", the widget rendering displays "my char &e..." because when truncate is executed, the string is encoded and some chars are encoded : "my char &eacut;, so bad truncate".

The size between the encoded string and the displayed string are different. So to fix this, we implemented a new method to truncate the content. This method identify each special char as one char, and truncate.

"my char é, so bad truncate" encoded to "my char &eacut;, so bad truncate" become "my char &eacut;..." and not "my char &e..."

Thanks: Charles Steltzlen who help to solve it

Copy link

sonarcloud bot commented Nov 5, 2024

@nmalin nmalin merged commit 511ca18 into apache:trunk Nov 12, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant