How To Change The Code Page

Table of contents:

How To Change The Code Page
How To Change The Code Page

Video: How To Change The Code Page

Video: How To Change The Code Page
Video: How to Edit a Web Page/Change Text in Your Browser [Tutorial] 2024, May
Anonim

When loading a website page, the browser receives a lot of information, including data about the code page that determines the display parameters of the language. Usually, the code page is set when creating a site, but sometimes it becomes necessary to change it on an already working resource.

How to change the code page
How to change the code page

Instructions

Step 1

Codepages are required to support different languages, with each page numbered. For example, the Cyrillic alphabet corresponds to the encodings Windows 1251, KOI8-R, KOI8-RU, ISO8859-5, DOS 866. Of these, the first is most widespread on the Internet. Other languages have their own encodings.

Step 2

Considering that there are many languages, the old encodings at some point began to be lacking, they turned out to be not very convenient. Therefore, in 1991, the non-profit organization "Unicode Consortium" proposed a new encoding option that allows representing the alphabets of almost all existing languages. The code was named "Unicode".

Step 3

Unicode has several variants of representation, the most famous being UTF-8. On the Internet, it was he who began to gradually replace the old encodings. The advantage of Unicode is that when you enter the page, you will never see a set of incomprehensible characters instead of letters. Characters encoded in UTF-8 are displayed correctly on computers with any language. Sometimes the term "Unicode" is used as a synonym for the UTF-16 encoding used in Windows interfaces.

Step 4

Since users of other countries also visit the resources of the Russian Internet, replacing old encodings with a new one has become quite relevant. After all, incorrect display of the text forces the user to leave the resource, which negatively affects its popularity. To change the encoding of a page, open it in Dreamweaver. Select the menu "Modify" - "Page Properties". In the window that opens, select the "Name / encoding" item, set the encoding "Unicode (UTF-8)" and click OK. The Include Unicode Signature (BOM) box is unchecked. Change all the pages of the site this way.

Step 5

If your site is hosted on an Apache web server (this data is in the hosting reference materials), you should create an.htaccess text file in Notepad ++ (with a period at the beginning). It is done like this: open Notepad ++, select "File" - "New". Enter the following line into it: AddDefaultCharset utf-8. If this file already exists, just add the specified line to it.

Step 6

Now click "Encodings" - "Convert to UNIX format". Close the program, you will be prompted to save. Confirm saving, choose a location for it. Specify the name of the.htaccess file, leave the file type as All types (*. *) And click “Save”. Now upload this file to the root directory of the site - in the same place where the main page file is located.

Step 7

If the site uses databases, add this line to the PHP code of the database connection before the closing tag?>: @Mysql_query ("SET NAMES 'utf8'");

Step 8

Translating a site to UTF-8 encoding can bring various problems, so work with a copy of the site. Replace the main pages with the modified ones only after you are sure everything works. If necessary, search online for reference materials that describe your particular situation.

Recommended: