[ 
https://issues.apache.org/jira/browse/OFBIZ-13167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17897424#comment-17897424
 ] 

ASF subversion and git services commented on OFBIZ-13167:
---------------------------------------------------------

Commit 511ca1830d00c2002d4dc2f9f24a8c27264bedde in ofbiz-framework's branch 
refs/heads/trunk from Nicolas Malin
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=511ca1830d ]

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

* Amélioration de la function de truncate string

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

<form...>
    <field name="myfield" ...><display size="15"/></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 &ea...ate" 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;, ...ate" and not "my char &eac...ate"

Thanks: Charles Steltzlen who help to solve it


> Truncate string with special character
> --------------------------------------
>
>                 Key: OFBIZ-13167
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13167
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework/widget
>            Reporter: Nicolas Malin
>            Assignee: Nicolas Malin
>            Priority: Minor
>
> On model form, when you use a field description with a text size like :
> {code:java}
> <form...>
>     <field name="myfield" ...><display size="10"/></field>
> </form>{code}
> 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..."



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to