mundschenk-at / php-typography

A PHP library for improving your web typography.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No support for the uppercase Norwegian character 'Å'?

sjenset opened this issue · comments

I'm using this on a website, through the plugin Craft Typogrify - and whenever I try to typogrify a word/sentence starting with a Norwegian character it seems to output nothing at all. I've reported an issue to the plugin-creator, but after further investigation, it seems that this behavior is the same when I try to use just this library directly as well.

Example:

$settings = new \PHP_Typography\Settings();
$settings->set_hyphenation( true );
$settings->set_hyphenation_language( 'en-US' );

$typo = new \PHP_Typography\PHP_Typography();

$hyphenated_html = $typo->process( $html_snippet, $settings );
var_dump($html_snippet, $hyphenated_html);
exit;

Output:

string(15) "Årø Bilsenter" string(0) ""

EDIT:

I've tested a little more - most Norwegian characters seem to work just fine, the exception being the uppercase Å.

Example:

$typo->process('æ', $settings);
$typo->process('ø', $settings);
$typo->process('å', $settings);
$typo->process('Æ', $settings);
$typo->process('Ø', $settings);
$typo->process('Å', $settings);

Output:

ø
æ
å
Æ
Ø
''

That's pretty weird. You are using UTF-8 as your encoding?

File-encoding is UTF-8, yeah

[vagrant@tibox cases]$ file -bi _index.twig
text/html; charset=utf-8

Installation information:

 - Installing mundschenk-at/php-typography (v6.1.2): Loading from cache
    Skipped installation of bin src/bin/update-patterns.php for package mundschenk-at/php-typography: name conflicts with an existing file
    Skipped installation of bin src/bin/update-iana.php for package mundschenk-at/php-typography: name conflicts with an existing file
  - Installing nystudio107/craft-typogrify (1.1.7): Loading from cache

Dunno if it could possibly be caused by one of the skipped packages?

It's pretty weird (because even an encoding issue should just return the input string), but I've been able to reproduce the issue on my setup. I'll look into it.

Awesome. Make sure you catch my update in the original comment, as this seems to only be regarding the uppercase Å :)