Subtituition of special characters by ASCII codes

Asked

Viewed 925 times

6

I’m getting a site buildable in charset ISO and when I step to UTF-8 the special characters appear on the screen with that diamond and a question mark, then in addition to switching from charset I need to exchange characters for ASCII codes.

Ex: á - á
    é - é
...

How can I do this faster? Any PHP function?

  • 1

    an intermediate solution would be why at the beginning of PHP: declare(encoding='ISO-8859-1'); while you tidy up.

  • 1

    you have the sources already with the problem? A solution could also be mass replacement with a good code editor, but it is relatively dangerous. If you’re just converting to the screen, you can use Antonio’s solution. If you give more details on the question, it helps.

  • I’m putting some options, I’m not sure I fully understand what you need.

  • Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?

1 answer

3

If I understand what you want has a function ready for this, it’s the htmlentities().

If you want to change this in the HTML source, you can make a script quick to process all files using this function.

It also has several utilities to do this, including online.

Depending on the editor you are using it has how to do this on some option or at the time of saving.

In addition you can use what Bacco commented declare(encoding='ISO-8859-1'); in each PHP file, establishing a directive for the correct generation of HTML.

  • Thanks @bigown

Browser other questions tagged

You are not signed in. Login or sign up in order to post.