-1

How make the Portuguese characters look fine on html?

That's what I have used in my html

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

enter image description here

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78

1 Answers1

-1

I used to have lots of similar problems but now have a policy of always translating to html codes (as listed on (for example) http://www.starr.net/is/type/htmlcodes.html) for rendering. This saves a lot of grief (and testing) in my experience.

MandyShaw
  • 1,088
  • 3
  • 14
  • 22
  • 1
    Encoding is not that hard. It's an entirely solvable problem once you understand the basic premise. There's absolutely no need to force yourself to work with gobbledygook when it's trivial to correctly support perfectly readable text. https://stackoverflow.com/a/35312471/476 – deceze Apr 16 '18 at 16:05
  • Wow! And what do you do if the data is coming from the database? You save HTML code there? And what do you do if you want to consume APIs? You call the owners and ask them to change the API for you? How hard is it to simply use UTF-8 for all your steps, and done? The first step of doing anything the right way is "learn". – Racil Hilan Apr 16 '18 at 16:13
  • We'll have to agree to differ, I find automatic translation to html codes via (in my case) a single mysql function a great deal easier than the mechanism recommended on the other thread (which I have tried previously without success). P.S. No, I do save some unicode in the database, I translate it for rendering (and also, via php, following API calls). I am happy to do everything in unicode at the server side, I just find it easier not to worry about rendering it. Clearly I am in a minority here though. – MandyShaw Apr 16 '18 at 16:14
  • 1
    A single function? Perhaps you only work on tiny websites or tools. It seems you only need to display data and you never worked with APIs either. When you start working on bigger projects, you'll quickly find yourself in need for much more than one function and you'll have to solve the performance issues resulting from not being able to use indexes. You tried it without success because you forgot to "learn" how to do it properly. There are many things in life that we cannot learn by trying, we actually have to grab a book and read. – Racil Hilan Apr 16 '18 at 16:22
  • I'm not sure what the relevance of indexing is given that the translation to html codes is purely for rendering, but I'm happy to leave it if you are. – MandyShaw Apr 16 '18 at 16:26
  • If you save Unicode in the database, then you've already done half the job. You only need to set the correct HTML header and save all your HTML rendering files in Unicode too. Is that really too hard? And yes, like I said, if you only display data from the database, then your indexes will work fine. But when you start working on bigger projects, you'll need to save to the database, so you'll need another function to translate in the other way. And you'll need to search in the database, in which case you have to figure out how to make the indexes work with your function. Not very easy. – Racil Hilan Apr 16 '18 at 16:38
  • OK, I'll have another go at the rendering. It's only the HTML rendering I have previously failed to get to work correctly. Unicode input works fine already, strangely. Thanks for your advice. – MandyShaw Apr 16 '18 at 17:38