#1 2018-11-02 14:15:47

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Confusion about Utf8TruncateToLength and company

@ab - I use a function

Utf8TruncateToLength('Обрізати до 10 літер', 10);
// expect 'Обрізати д'
// but actual 'Обрі'

and expect result to be truncated to 10 UTF8 characters, but actual result is truncated to ~10 bytes.

Is it valid behavior?
If yes, then my propose is to change UTF8*Length functions documentation (and the name of parameter maxUTF8 -> maxBytes)
because current documentation is confused...

Offline

#2 2018-11-02 22:34:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,670
Website

Re: Confusion about Utf8TruncateToLength and company

It is truncated to equal or less than 10 bytes IIRC.

Offline

#3 2018-11-02 22:47:14

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Confusion about Utf8TruncateToLength and company

I made a pull request to documentation about this

Offline

Board footer

Powered by FluxBB