October: HtmlBuilder::limit fails with umlauts

Created on 4 Feb 2016  路  5Comments  路  Source: octobercms/october

When passing a string to HtmlBuilder::limit that includes umlauts, the string encoding somehow gets messed up. The following test case fails: https://github.com/OFFLINE-GmbH/library/commit/dbaff8e164f5b081e03b72e1e12c4b9f4c72cb36

public function testLimitEncoding()
{
    $result = with(new HtmlBuilder)->limit('<p>Er h枚rte leise Schritte hinter sich. Das bedeutete nichts Gutes.</p>', 10);
    $this->assertEquals('<p>Er h枚rte l...</p>', $result);
}

Expected output is

<p>Er h枚rte l...</p>

Received output is

<p>Er h枚锟絫e l...</p>

Most helpful comment

It looks like this issue is no longer present. The test passes now without any changes. Let me know if you want a PR with the test:

https://github.com/OFFLINE-GmbH/library/commit/9fb0730579a2df0629cb6d3fe803466eb0d0311e

All 5 comments

If this is still an issue, please log it in the main October repo. Also consider submitting a Pull Request to fix it, most of our multi lingual features stem from the community.

@tobias-kuendig did this ever get fixed?

It did not! I might find some time next week and see if I can still reproduce this issue and implement a fix.

It looks like this issue is no longer present. The test passes now without any changes. Let me know if you want a PR with the test:

https://github.com/OFFLINE-GmbH/library/commit/9fb0730579a2df0629cb6d3fe803466eb0d0311e

@tobias-kuendig sure, can't hurt

Was this page helpful?
0 / 5 - 0 ratings