UTF-8
Posted by: Carlos R D (---.cslce201.dial.brasiltelecom.net.br)
Date: June 10, 2016 03:29PM

Hi
I have a table column header <td><b>Histórico</b></td> and it shows de weird character ? : Hist?rico
Included the meta <meta charset="utf-8" />
and also tried the long <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Also added AddDefaultCharset UTF-8 in httpd.conf (before the last line Include "c:/wamp64/alias/*" )

Note that it's a static title, not from the returning recordset.

Nothing worked so far (?)
Thanks

Options: ReplyQuote
Re: UTF-8
Posted by: RiggsFolly (Moderator)
Date: June 10, 2016 03:40PM

Hi

This is not really a WAMPServer issue, but: What DOCTYPE are you using?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: UTF-8
Posted by: Carlos R D (---.cslce201.dial.brasiltelecom.net.br)
Date: June 10, 2016 05:12PM

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

Options: ReplyQuote
Re: UTF-8
Posted by: Otomatic (Moderator)
Date: June 10, 2016 05:18PM

Hi,

> Included the meta <meta charset="utf-8" />
> and also tried the long <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

This is not really the domain of this forum, however, several "tricks".
- The charset header sent by a PHP header overrides all meta declarations.
- PHP from PHP 5.6 is by default with utf-8 charset.
- Maybe just need after your logon procedure to MySQL database send a directive SET NAMES UTF-8
- You must also look at what is the charset used in your tables.

> Also added AddDefaultCharset UTF-8 in httpd.conf (before the last line Include "c:/wamp64/alias/*" )
This does not set what charset will be used in MySQL query returns.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: UTF-8
Posted by: Carlos R D (---.cslce201.dial.brasiltelecom.net.br)
Date: June 10, 2016 11:52PM

I'm really lost. Read at [htmlpurifier.org]
"If you're feeling particularly courageous, you can use:

AddDefaultCharset UTF-8 ...which changes the character set Apache adds to any document that doesn't have any Content-Type parameters."

"These directives can also be placed in httpd.conf file for Apache"

Exactly what I did!
Bur of course understand that this is not domain of this forum, just thinking it could be useful for others.
Regards.

Options: ReplyQuote
Re: UTF-8
Posted by: Otomatic (Moderator)
Date: June 11, 2016 09:41AM

Hi,

> AddDefaultCharset UTF-8 ...which changes the character set Apache
> adds to any document that doesn't have any Content-Type parameters."
Your problem is not there. It is useless to put a charset directive to Apache; any PHP header surpass this statement.

I repeat:
- Maybe just need after your logon procedure to MySQL database send a directive SET NAMES UTF-8
- You must also look at what is the charset used in your tables.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: UTF-8
Posted by: Carlos R D (---.smace701.dsl.brasiltelecom.net.br)
Date: June 11, 2016 01:24PM

Thanks for taking time to answer a question isn't on scope of this forum.
I tested the page just writing "período" "histórico" statically.
In this specific query I did as a test, recordset doesn't contain accented words (just by chance). And these title accented words are before PHP code:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="estilo.css">
</head>
<title>
CONSULTA POR PERÍODO
</title>
<body>
<table>
<thead>
<tr>
<td><b>Período</b></td>
<td><b>Histórico</b></td>
<td><b>R$</b></td>
</tr>
</thead>
<tbody>
<?php
include 'ConexaoMySQL.php';
try {

[notice that now I removed the meta UTF-8 for being useless...]

Options: ReplyQuote
Re: UTF-8
Posted by: Carlos R D (---.smace701.dsl.brasiltelecom.net.br)
Date: June 11, 2016 01:35PM

DATABASE (MySQL)
Conjunto de caracteres do servidor: UTF-8 Unicode (utf8)

Collation of the example table is latin1_swedish_ci
(the default)

But also, as said above, I tested just wroting the plain words...

Options: ReplyQuote
Re: UTF-8
Posted by: Carlos R D (---.cslce201.dial.brasiltelecom.net.br)
Date: June 12, 2016 01:33PM

Figured out: file was in ANSI!
Stupidity of mine!
Thanks for your attention.

Options: ReplyQuote
Re: UTF-8
Posted by: Otomatic (Moderator)
Date: June 12, 2016 01:38PM

There is nothing worse than finding errors that we ourselves created.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.