0
Good morning, after searching extensively for solutions to my problem, trying various solutions that have been suggested in other questions, like this one for example:
https://stackoverflow.com/questions/22653119/what-does-phps-mb-internal-encoding-actually-do
I am seeking information from a php post of a query to the Oracle database, but the output of this information may contain special characters: in the database is saved as "John" in the post comes out "Jo? the".
I would like the friends tip for a configuration (ideal that is global php.ini) where you can configure the output php charset. Some settings I’ve made:
PHP.ini
default_charset = "utf-8"
internal_encoding = 'utf-8'
output_encoding = 'utf-8'
Index.php
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta charset="utf-8" />
</head>
<body>
<?php
var_dump($result1);
?>
...["NAME"]=> string(4) "Jo? o" ...
Being that in the database is saved correctly:
Connection to the bank:
$host="10.0.0.2";
$service="//10.0.0.2:1521/orcl";
$conn= new \PDO("oci:host=$host;dbname=$service","USER","senha");
If I give the command below to check the encoding of the string, I get 'ASCII'
echo mb_detect_encoding($result1['NOME']);
I have also tried using Function utf8_encode(); but nothing changes.. :(
If I write other texts in index.php that contain special characters they are displayed normally, so I believe it is not some config in the file at the editor or meta tag level.
Thank you very much in advance.
I’m pretty sure it has something to do with this: http://answall.com/questions/8429/php-echo-problema-specialcharacteristics-%C3%A7
– Miguel
@Miguel I tried to do the suggested in the post: setlocale(LC_ALL,'pt_BR.UTF8'); mb_internal_encoding('UTF8'); mb_regex_encoding('UTF8'); but then I get the error in the console: Uncaught Error: Call to Undefined f unction mb_internal_encoding()
– Gabrielhn
Could you add your connection to the bank to the question? You have already taken a look at this topic: http://answall.com/questions/43193/d%C3%Bavida-com-charset-iso-8859-1-e-utf8
– Allan Andrade
Can you see where it was recorded? Terminals or program files that can have this encoding?
– William Aparecido Brandino
@Allanandrade added the question.
– Gabrielhn
@Williamasimiliar Andean made the data Insert in the database via normal INSERT.
– Gabrielhn
@Gabrielhn, try this in your connection string => $Conn= new PDO("oci:host=$host;dbname=$service;charset=utf8","USER","password");
– Allan Andrade
In my connection I added this line putenv("NLS_LANG=PORTUGUESE_BRAZIL.AL32UTF8") or die("Failed to insert the environment variable");
– adventistaam
This might help http://answall.com/a/43205/3635
– Guilherme Nascimento
There is also the file Find. Notepad++ is the easiest editor to view Find the right file and set UTF8.
– Antonio Alexandre