-2
Hello, my dear! The doubt below is well Noob, but it’s burning my neurons...
I recently installed Cakephp 4.2.8, PHP 7.4.9.
I’m walking through the Cakephp tutorial, and I made a Bake for one of my tables in the database. As usual, everything came in English, and I translated the texts that will be displayed to the user.
It turns out that when I set an accent text, they don’t display correctly in the browser. Let’s use as an example the index.php template generated by Bake:
<h3><?= __('Estados da Federação') ?></h3>
The accents are not displayed:
If I put the HTML entities manually, it works: <h3><?= __('Estados da Federação') ?></h3>
is displayed correctly.
However, if I use h
or its full version, htmlspecialchars
, keeps coming up wrong. If I use htmlentities
is even worse: <h3><?= __(htmlentities('Estados da Federação')) ?></h3>
does not display anything. The final HTML for the user appears as <h3></h3>
and I get a blank line.
I don’t think it’s a problem charset, because I’ve already researched some guides on web, and all settings I found are already in UTF-8.
Does anyone know how to solve the accent problem without having to put HTML entities for all accented letters? I’m sure that’s an extremely Noob, but I’m hitting myself with it severely.
Please edit the question to limit it to a specific problem with sufficient detail to identify an appropriate answer.
–
The robots are high...
– César Rodriguez
You are using
__()
Why do you need internationalization? If you don’t need it, remove it. Finally check out the file– Erlon Charles
@Erloncharles As I said, I am Noob in cake and I am doing the tutorial. I will test to see if it works without it.
– César Rodriguez
Save it, my dear @Erloncharles! I tried to take the function
__()
, but it didn’t make any difference. The archive’s database is in UTF-8. All the application settings in cake are UTF-8, and the HTML that is generated for me in the browser also has, in the header, the tagmeta
for the UTF-8 encoding.– César Rodriguez
I am now trying to upgrade to a test server and see if it is something that is going wrong just on my computer.
– César Rodriguez
By the way, WHAT A HARMFUL COMMUNITY! I asked a simple question and two people took the trouble to give dislike without even trying to answer... Putz! This community is weighing on me so I can forget about Cake and learn Laravel.
– César Rodriguez