Skip to content

Bug with utf-8 trimming #187

Description

@Loki3000

Hi!
I found bug with multibyte strings cutting
service/notesservice.php string 116:

$title = substr($title, 0, 100);

$title with utf string becomes about 50 chars and sometimes has half of next char. File with same name becomes inaccessible and application crashes.
Instead of present must be follow:

$title = mb_substr($title, 0, 100);

But it's also not enough. It's need to set internal encoding for mbsring extension:

mb_internal_encoding("UTF-8");
$title = mb_substr($title, 0, 100);

After that file saving works right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions