L
L
Lorem Ipsum2014-08-01 20:12:48
PHP
Lorem Ipsum, 2014-08-01 20:12:48

PHP - how to solve encoding problem?

Hi, I'm editing the file in notpad in UTF-8 encoding without BOM
PHP code

var_dump(mb_detect_encoding( '/data-alt-lite/'));
var_dump(mb_detect_encoding(iconv('cp1251', 'UTF-8', '/data-alt-lite/')));

outputs this
string 'ASCII' (length=5)
string 'ASCII' (length=5)

Why and how to convert it to UTF-8?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
whats, 2014-08-01
@whats

var_dump(mb_detect_encoding( '/data-alt-lite/','UTF-8'));
var_dump(mb_detect_encoding(iconv('cp1251', 'UTF-8', '/data-alt-lite/'),'UTF-8'));

var_dump(mb_detect_encoding( 'Русские буквы'));

Text consisting only of characters less than 128 is converted to plain ASCII text when written in UTF-8. Conversely, in UTF-8 text, any byte with a value less than 128 represents an ASCII character with the same code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question