Accent and port problem on localhost

Asked

Viewed 554 times

-1

Does anyone know how to set up the charset?

The problem is that it’s appearing like this:

Informa es

Imagery:

erro acentos

And another, my localhost is on: http://localhost:8888, where I set to leave only http://localhost?

  • 1

    The important thing is you define which one will use and configure the editor, the server and everything else in the application to stay the same. If any old page does not get correct, almost all code editors allow you to open in one format and save in another to fix. But if the server is not configured BEFORE then, you may be tidying up on the screen, but doing exactly the opposite of what you want. An alternative is to use htmlentities until you decide. Example: if the source is written acentuação will exit right in browser (acentuação) on any charset.

  • So that’s what I was talking about . _. as the charset is iso-8859-1 and is giving accentuation error because the server is probably utf-8. I just wanted to know where to change the MAMP charset in si xD

1 answer

3


These are two questions of a very different nature, but posted as one, it would be interesting if the next ones were asked separately. Anyway, there it goes:

Defining Apache charset headers:

In the file "httpd.conf" you need this entry:

AddDefaultCharset utf-8

(or iso-8859-1, if you prefer, among others. The most appropriate depends on the purpose of its application, I will not enter this merit in this answer)

File location varies from distribution to distribution, for example /private/etc/apache2/httpd.conf, or part of Linux on /etc/httpd/conf.

It is important that in case you also define the charset in your HTML files, keep them consistent with charset Apache, to avoid unexpected results.


To access the server without specifying port:

By default it is 80 the HTTP port, and 443 the HTTPS port.

If you want to use any port other than these, you really need to type the URL in the server:port format.

In Apache, this is defined by default in:

Listen 80

or even

Listen ENDERECO_IP:80

for virtual hosts, after the : of these Directives

<VirtualHost *:80>
  • That’s right ;) Thank you very much!

Browser other questions tagged

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