This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi guys,
my layout (default) displays non English characters (Croatian letters č,ć,š,ž,đ) and page (about) does not. I've set in layout file.
my layout looks roughly like this:
body
headline
navigation
{% page %}
{% partial 'footer' %}
body
I have tried non-english characters in both one page (about) and in footer with the same result. Here is a part of text not displaying properly (enclosed in p tags) : ",rođen je u Budimpešti,a odrastao je u Bratislavi (Slovačka)."
I suspect it is something related to Twig but I don't know how to pinpoint the error. Does anyone know how to fix this?
Thank you.
Last updated
I have tried non-english characters in both one page (about) and in footer with the same result. Here is a part of text not displaying properly (enclosed in p tags) : ",rođen je u Budimpešti,a odrastao je u Bratislavi (Slovačka)."
How are you outputting content with Croatian characters? (BTW, they are displaying just fine for me ;) Can you look at your MySQL connection charset, database and table field collations?
I suspect it is something related to Twig but I don't know how to pinpoint the error. Does anyone know how to fix this?
Show us your Twig output tags, please.
Thank you for quickly replying.
MySQL charset in config->database.php is set to 'utf-8', each tables collation in database is set to 'utf8_unicode_ci', field collation is empty in all tables. This is a static part of a page.
Twig (default.htm - layout file):
description = "Default layout"
==
<!DOCTYPE html>
<html lang="hr">
<head>
<meta charset="UTF-8"/>
</head>
<body>
<div class="brand">Name</div>
<div class="address-bar">Location ćčš</div> //this one contains ć originally and displays properly
{% partial 'navigation' %}
<div class="container">
{% page %}
</div>
{% partial 'footer' %}
</body>
</html>
navigation was displaying "properly" until I've put it to partial named navigation. After that it doesn't display Croatian characters.
navigation.htm: (as partial)
<nav class="navbar navbar-default" role="navigation">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="{{ 'home'|page }}">Naslovnica ć</a>
</li>
<li>
<a href="{{ 'about'|page }}">O nama č</a>
</li>
<li>
<a href="">Treninzi ž</a>
</li>
<li>
<a href="">Kontakt š</a>
</li>
</ul>
</div>
</div>
</nav>
If you need more info say it and I'll try to specify in future posts.
boroboris said: MySQL charset in config->database.php is set to 'utf-8', each tables collation in database is set to 'utf8_unicode_ci', field collation is empty in all tables. This is a static part of a page.
Everything looks right up to this point.
navigation was displaying "properly" until I've put it to partial named navigation. After that it doesn't display Croatian characters.
How was that partial created - from Backend/CMS or local text editor with FTP upload?
BTW, this site runs on OctoberCMS with forum plugin and we can see Croatian diacritics just fine...
boroboris said: It was created by text editor (PhpStorm) and then uploaded via git.
That could be it - check your File Encoding status for navigation.htm
(bottom right of PhpStorm window). Also, there are various per IDE and per project settings (search for "encoding" in File|Settings).
Eoler said: That could be it - check your File Encoding status for
navigation.htm
(bottom right of PhpStorm window). Also, there are various per IDE and per project settings (search for "encoding" in File|Settings).
Thanks, man. :)
I've tried to change encoding in PhpStorm and you were right. It was set to system default (Windows-1252). I've changed it to UTF-8. That didn't fix my problems though.
But once I've opened files in question in backend editor, saved them and opened them in browser the problem was fixed. Well at least for newly added characters. I now can see Croatian letters normally, and in PhpStorm I can see � (REPLACEMENT CHARACTER) in all those places with non-english characters, both in PhpStorm and October backend editor.
So this could be an acceptable workaround. By this I mean to create page/partial in backend editor and continue work on it in PhpStorm.
What I'm curious about is why did that happen in first place and how to prevent it?
Also, now the new page that I've created from editor displays Croatian characters normally.
Last updated
boroboris said: So this could be an acceptable workaround. By this I mean to create page/partial in backend editor and continue work on it in PhpStorm. What I'm curious about is why did that happen in first place and how to prevent it?
Prevent it by studying various encoding options in PhpStorm and configuring File/Dir, project and IDE: https://www.jetbrains.com/phpstorm/help/file-encodings.html
1-8 of 8