I made a program that extracts my notes from my code and creates a txt
file to be a little manual. I formatted to stay cool:
+-----------+
| |
| ESPECIAIS |
| |
+-----------+
It takes the SPECIAL line and formats it. Simple! It happens that some are not well formatted because there are letters with an accent, and in this case I can not count the tones correctly. The line "FUNCTIONS" looks like this:
+-----------+
| |
| FUNÇÕES |
| |
+-----------+
This is because the string is formed by the 70|85|78|195|135|195|149|69|83
codes adding 9 characters to the strlen
fault of PHP, since the accents are using the prefix 195, extrapolating the count to 2.
This particular problem is not difficult to solve, but I want to take this opportunity to better understand the issue. I do not know how encoding works in this case (UTF-8 text file).
In JavaScript I count the strokes using DOMElement.textContent.lenght
which already understands the string as text.
Is there a similar function in PHP?