Example:
A Menu-Link (Title) in the textfile should name “Über uns” [About].
If i encode them with “Ü” then the link will not be translated, if i encode them with “Ü” then the menu-item would not be displayed.
Ok, i am very new to Kirby and therefore i tuck the 2.4.1-Starterkit and changed for the first steps only the contents (text).
content\6-about\about.txt: (windows notation on the local drive before copied via FTP to the webserver)
Title: Ueber uns
Description: Über ...
Intro: Alternatives, ökologisches
this will be ok, with the exception of clearly missing German-Umlaute:
(Einfuehrung / Produkte / Dienstleistung / Technische Daten / Ueber uns / Kontakt)
but if i use:
Title: Über uns
will display nothing, the menu-item is simply gone:
(Einfuehrung / Produkte / Dienstleistung / Technische Daten / / Kontakt)
and again:
Title: Über uns
will not translate the HTML-entity into the correct char.
In contrast: the Intro-Field witch is read with: <?= $page->intro()->kirbytext() ?>
will correctly translate the ökologisches into “ökologisches”.
Sorry, enabling the .htaccess-entry doesn’t help anything.
The question is, why does the text (menu-entry) disapear and not only the unrecognized character be market like in “kirbytext()”?
Can you provide the code you use to render your menu links?
I don’t think this is a Kirby related problem, must be something related to your server. If this does not help, please provide more information about your OS, PHP version etc.
Hi texnixe,
i have setup a clean new Kirby Starterkit 2.4.1 on a fresh clean Strato-Webserver.
In addition you will see a clean static HTML-page to compare what the webserver is doing with HTML-entities. Furtermore, i have prepared a php-page with the server-infos.
The only two lines in the Starterkit what i have modified is:
1.) in the content/3-about/about.txt: "Title: Über uns"
2.) in the .htaccess: enabling (uncomment) the line “AddDefaultCharset UTF-8”.
You can see whats happen in the following line (on the kirby starterkit home):
Hi texnixe,
this is working, but it is not a problem-solver as such, because it’s not the only place with entity problems, like i mentioned before.
The complete Starterkit is based on this “->html()”-routine, what means that the complete Starterkit can’t handle HTML-entities at all!
This means not only it can’t handle european-characters, also any special-characters like “TM”, “Euro” etc. are affected. For example, the custom-meta-tags, caption for images and so on are all affected.
No problem with that as such, if i know the reason, but is it flagged as a Bug and forwarded to development?
Will it be fixed in the next Kirby-release?
BTW: excuse my faulty first handling of the forums-editor, thus tampered the sense completely.
Hi @HJR, I did a test with Xampp on Windows. I think your problem is caused by the fact that you probably haven’t saved your files as UTF-8 without BOM. Once you do, everything should work fine.
Is a 7-Bit-ASCII-file not UTF-8 compatible?
What is wrong on “named-entities”?
So far as iam now understand, the whole problem is not a matter of a file-format, rather then on the kirby-toolkit function “html()”.
This function is a filter-function and uses some php-functions like: “htmlspecialchars” without the 3rd-parameter.
You can check this by using plain php-functions, like i did.
Well, one option would be to simply not use the html() method at all. You can also create your own custom field method. But as I said, saving the file in the correct format should actually solve the issue as well.
For me it works using ­, together with the kirbytext() or markdown() field methods, or, if you don’t want the html output produced by these method, use a custom function.