Charset Changing: Difference between revisions

no edit summary
m (Reverted edits by TebRw9 (Talk); changed back to last version by FredT34)
No edit summary
Line 1: Line 1:
This wiki article will help you change your <u>Char</u>acter <u>Set</u> to something else other than the default Uniform Server setting (ISO-8859-1 / latin1).
=[http://ogetehuvo.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
This wiki article will help you change your &lt;u&gt;Char&lt;/u&gt;acter &lt;u&gt;Set&lt;/u&gt; to something else other than the default Uniform Server setting (ISO-8859-1 / latin1).


In this article, our goal is to set the charset to '''cp1250'''
In this article, our goal is to set the charset to '''cp1250'''


==Apache==
==Apache==
Find this statement in the Apache configuration file (W:/usr/local/apache2/conf/httpd.conf) <pre>AddDefaultCharset iso-8859-1</pre> and change it to: <pre>AddDefaultCharset WINDOWS-1250
Find this statement in the Apache configuration file (W:/usr/local/apache2/conf/httpd.conf) &lt;pre&gt;AddDefaultCharset iso-8859-1&lt;/pre&gt; and change it to: &lt;pre&gt;AddDefaultCharset WINDOWS-1250
AddCharset WINDOWS-1250 .cp-1250 .win-1250</pre> ''Note: See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets for the official list of charset names and their respective RFCs.''
AddCharset WINDOWS-1250 .cp-1250 .win-1250&lt;/pre&gt; ''Note: See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets for the official list of charset names and their respective RFCs.''


==MySQL==
==MySQL==
# In the file (W:/usr/local/mysql/bin/my_small.cnf) find line: <pre>Uncomment the following if you are NOT using BDB tables</pre>
# In the file (W:/usr/local/mysql/bin/my_small.cnf) find line: &lt;pre&gt;Uncomment the following if you are NOT using BDB tables&lt;/pre&gt;
# Insert the two following lines, '''before''' the line above: <pre><nowiki>character-set-server = cp1250  
# Insert the two following lines, '''before''' the line above: &lt;pre&gt;&lt;nowiki&gt;character-set-server = cp1250  
collation-server = cp1250_general_ci</nowiki></pre>
collation-server = cp1250_general_ci&lt;/nowiki&gt;&lt;/pre&gt;
# Restart Apache and MySQL and verify that system variables looks like this: <pre><nowiki>character set client latin1 cp1250
# Restart Apache and MySQL and verify that system variables looks like this: &lt;pre&gt;&lt;nowiki&gt;character set client latin1 cp1250
character set connection cp1250 cp1250
character set connection cp1250 cp1250
character set database cp1250 cp1250
character set database cp1250 cp1250
Line 19: Line 20:
collation connection cp1250_czech_cs cp1250_general_ci
collation connection cp1250_czech_cs cp1250_general_ci
collation database cp1250_general_ci cp1250_general_ci
collation database cp1250_general_ci cp1250_general_ci
collation server cp1250_general_ci cp1250_general_ci</nowiki></pre>
collation server cp1250_general_ci cp1250_general_ci&lt;/nowiki&gt;&lt;/pre&gt;




Line 25: Line 26:
From now all databases will be correctly set to cp1250 and your dynamic data will be presented in the new character set.  
From now all databases will be correctly set to cp1250 and your dynamic data will be presented in the new character set.  


''Note 1: There might be old application databases that are not automatically recorded into the new charset. You should do it "manually" prefarably via phpMyAdmin.''
''Note 1: There might be old application databases that are not automatically recorded into the new charset. You should do it &quot;manually&quot; prefarably via phpMyAdmin.''


''Note 2: This does not generally mean that your application will send correctly formatted data into the database! If they are not sent correctly, they can later be presented correctly in your browser so you have to adjust the PHP application now!''
''Note 2: This does not generally mean that your application will send correctly formatted data into the database! If they are not sent correctly, they can later be presented correctly in your browser so you have to adjust the PHP application now!''


==PHP==
==PHP==
If you have a PHP definition or configuration file, the file where global interraction with MySQL is set, (look for a filename like: definition.php, cofig.php, etc.) in the "appropriate" place (you have to find the place yourself,) insert two lines of code: <pre>mysql_query("SET character_set_connection=cp1250");
If you have a PHP definition or configuration file, the file where global interraction with MySQL is set, (look for a filename like: definition.php, cofig.php, etc.) in the &quot;appropriate&quot; place (you have to find the place yourself,) insert two lines of code: &lt;pre&gt;mysql_query(&quot;SET character_set_connection=cp1250&quot;);
mysql_query("SET character_set_client=cp1250");</pre>
mysql_query(&quot;SET character_set_client=cp1250&quot;);&lt;/pre&gt;




322

edits