Fix EZP-21443: Debug log displayed when using long japaneese strings in name

Link: https://jira.ez.no/browse/EZP-21443

# Description
When using a long object name the test (and the trimming) was using a method that is not compatible with unicode.
The calls have been replaced with a unicode compliant method everywhere it was relevant in the file.

# Tests
Manual tests on Firefox.