E
E
EvgMul2016-06-14 18:20:12
PHP
EvgMul, 2016-06-14 18:20:12

How to output Cyrillic?

There is an elementary code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  
  <form action="index.php" >
  <label>Введите строку: <input name="string" type="text"></label>
  
  <input type="submit" value="Проверить">
  </form>

  <?php
    $string = $_REQUEST["string"];

    echo $string[0];
  ?>

  
</body>
</html>

But the problem is that if you enter a string in Russian, then an incomprehensible question mark is displayed. Encoding UTF-8, the browser also displays in this encoding. It looks like it's in php. How to get rid of it? Thanks in advance to all who respond.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2016-06-14
@IceJOKER

<php?=> <?php
Unless you're going to get the first character of the string, of course.

T
ThunderCat, 2016-06-14
@ThunderCat

php.ini: default_charset="UTF-8"
httpd.conf: AddDefaultCharset utf-8
mysql/my.cnf:
[client]
loose-default-character-set=utf8
[mysql]
loose-default-character-set=utf8
[ mysqld]
collation-server=utf8_unicode_ci
loose-default-character-set=utf8
character-set-server=utf8
init-connect='SET NAMES utf8'
skip-character-set-client-handshake

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question