0

Trying to finalize this project, yet the Cyrillic characters are not appearing correct on the final version uploaded.

What it is meant to look like - http://codepen.io/valik140795/pen/qadXOo

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>

What it looks like - http://prnt.sc/cfa68m


No my question is not the duplicate of another question, as I am not establishing a server nor working with any databases or tables. Im a novice.

vlad.rad
  • 1,055
  • 2
  • 10
  • 28
Valbone
  • 67
  • 1
  • 1
  • 9
  • UTF8 should display cyrilic corectly – OctoCode Sep 07 '16 at 20:38
  • 1
    It's an encoding problem. We can't say more without more information. Is your text encode with utf-8? Where it came from? – Federkun Sep 07 '16 at 20:40
  • You'll likely need to set the PHP headers, possibly the file-encoding, to UTF8 as well. Is the data extracted from a database? If so, you need to specify UTF8 there too. – Qirel Sep 07 '16 at 20:42
  • @Federico I don't know what it means for the text to be encoded in utf-8, i provided the source code in the codepen. The text came from various sources, but mostly a word file. How do i encode it to the appropriate format? – Valbone Sep 07 '16 at 20:44
  • Open your editor and save all these files using utf-8 (without BOM). – Federkun Sep 07 '16 at 20:47
  • Or use utf8_encode ( $text ) or iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text) – Szymon Sep 07 '16 at 20:48
  • yeah.. or don't. no, don't do it. – Federkun Sep 07 '16 at 20:52
  • @Federico Im using DreamWeaver and it doesn't have the utf-8 option whilst saving. Im using a mac, which could be an issue as well. Do you happen to know software which will allow me to effectively convert all the files to the appropriate type on Mac? Thanks. – Valbone Sep 07 '16 at 20:58
  • google: "mac save as utf-8". – Federkun Sep 07 '16 at 21:04
  • @Federico Done everything described there (created a new doc, copy pasted the code, saved with utf-8 and still no changes in the uploaded version. – Valbone Sep 07 '16 at 21:11

1 Answers1

1

Following issues can have place and are pretty often to see in the russian-speaking php community:

  1. <META charset> tag doesn't install encoding, it just tells to your browser about encoding. So if your HTML-editor has Windows-1251, so your browser will also interpret it with Windows-1251. You can test this if you don't set the <META charset> tag and install "automatic encoding detection" in your browser. There you will see, which encoding does your editor have.

  2. You can choose the "right" encoding you want to use (utf-8) in Notepad++ editor. Just convert to utf-8.

  3. It can be that on your server default encoding is Windows-1251 - then you should delete the AddDefaultCharset windows-1251 from the .htaccess server file and write AddDefaultCharset utf-8.

vlad.rad
  • 1,055
  • 2
  • 10
  • 28
  • Your point #3 has actually solved the issue for me. I simply added AddDefaultCharset utf-8 to the htaccess and it worked. Thanks! – Valbone Sep 08 '16 at 08:43
  • @Valbone It is very good! Can you then please accept my answer as the right one, so the others could also use my advices? – vlad.rad Sep 08 '16 at 13:30