-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCOLLATION.rtf
140 lines (140 loc) · 6.11 KB
/
COLLATION.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{\rtf1\ansi\ansicpg1252\deff0\deflang1030{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\colortbl ;\red0\green128\blue0;\red0\green0\blue128;\red255\green0\blue0;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 COLLATION ALL WORKING\par
\par
\b\fs40 HTML AND PHP\b0\fs20\par
\cf1 FORGET ABOUT THIS\par
<meta charset="ISO-8859-1"/> \par
OR THIS\par
<meta charset="iso-8859-2 / latin2"/>\par
YOU CAN USE THE SAME HEADER FOR ALMOST ALL LANGUAGES IF YOU TAKE THE NEXT TWO STEPS\cf0\par
\par
\cf2\b\fs24 YOU ONLY NEED TO DO TWO THINGS AND IT SHOULD WORK ALMOST FOR ANY LANGUAGE.\cf0\b0\fs20\par
\par
\b 1) PLACE THIS ONLY IN YOUR HTML DOCS HEADER\b0 . OR REPLACE IF YOU HAVE ANOTHER PREVIOUS META CHARSET WITH THIS ONE.\par
\cf2\b\fs24 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\b0\fs20\par
\cf0\par
\b 2) ENCODE ALL YOUR HTML AND PHP DOCUMENTS IN UTF8\b0 : THE ENCODE CAN BE SEEN IN PROGRAMS FOR EDITING CODE. I USE NOTEPAD++ (ITS A TOTALLY FREE AND NICE AND VERY SMALL PROGRAM, VERY RECOMMENDED).\par
\par
\cf3\b\fs28 IN NOTEPAD++\cf0\b0\fs20\par
\par
\b YOU GO TO THE MENU ENCODING AND CHECK THE ENCODE IS UTF8. IF YOU SEE ANOTHER CODE YOU WILL NEED TO CONVERT.\par
\par
FOR CONVERTING TO UTF8 GO TO THE MENU ENCODING AND CHOOSE CONVERT TO UTF8.\b0\par
\par
\cf1\b\fs22 IF YOU CONVERT FILES TO UTF8 AND YOU SEE WIERD CHARS IN THE CODE, FOLLOW THIS SIMPLE STEPS:\par
\b0\fs20 0-RECONVERT THE FILE TO THE PREVIOUS CODE (ANSI OR WHATEVER) \par
1- OPEN THE FILE WITH NOTEPAD++ AND COPY-CUT ALL THE FILE TEXT SO THE FILE IS OPEN BUT CLEAN FOR TEXT.\par
2- CONVERT THE FILE TO UTF8 (IN NOTEPAD++ MENU ENCODING/CONVERT TO UTF8)\par
3- PASTE THE ORIGINAL CODE AGAIN AND SAVE\par
\par
THATS BECAUSE IF YOU CODE THE FILE TO UTF8 WITH ESPECIAL CHARACTERS PREVIOUSLY WROTTEN IN ANSI, IT CAN BE VERY PROBLEMATIC\par
\par
\b\fs24 SETTING UTF8 AS DEFAULT FOR NEW DOCUMENTS IN NOTEPAD++\b0\fs20\par
IN PREFERESNCES / SETTINGS /INSIDE THE TAB\par
NEW DOCUMENT-DEFAULT DIRECTORY \par
UNDER ENCODING SELECT UTF8 AS DEFAULT FOR THE NEW DOCUMENTS YOU CREATE.\cf0\par
\par
\cf2\par
\cf0\b\fs40 PHP + MYSQL\par
\fs20 THE TRICK IS...\par
\par
\fs32 1 \cf4 SET NAMES utf8 \fs20\par
\par
\cf3\fs28 THIS AVOID ALL THE FAILS \cf4\ul INSERTING AND SHOWING \cf3\ulnone ESPECIAL CHARS\cf0\fs20\par
\cf4 if (!mysql_query("SET NAMES utf8")) \{\par
echo "Error: SET NAMES utf8.\\n";\par
exit;\par
\} \cf0\par
\cf4\par
\cf0\b0\par
\b\fs52 MYSQL\fs32\par
\par
\cf4\fs40 CONFIGURATION WORKING 0\fs20 \fs32 THE BEST \cf3 FOR SPEED AND MULTILANGUAGE \fs20 NO PROBLEMS WITH COLLATION...THE ONLY THING YOU NEED TO CALL THE APPROPIATTE QUERIES WITH THE APPROPIATE COLLATION FOR EACH LANGUAGE...\par
\par
\cf1\par
\cf3 WHEN YOU ARE SEARCHING IN A ESPECIFIC LANGUAGES YOU USE COLLATE LIKE THIS:\cf1\par
PHP-MYSQL - SEARCHING FOR CHARACTER "\'d1" AND SORTING THE RESULT, BOTH USING COLLATE utf8_spanish2:\cf3\par
\par
\cf4 $query = @mysql_query("SELECT * FROM usertable WHERE username \cf3 COLLATE utf8_spanish2\cf4 _ci LIKE '%\'d1%' ORDER BY username \cf3 COLLATE utf8_spanish2_ci\cf4 ");\cf3\par
\par
INSIDE MYSQL\cf1 (http://localhost/phpmyadmin/ FOR XAMP)\par
\cf0\b0\par
\fs32 EASY :)....ALL \cf4\b utf8_general_ci \cf0\b0\fs20\par
\par
AT HOME UNDER\par
General Settings \par
Server connection collation Documentation = \cf4\b utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY DATABASE SELECTED UNDER:\par
\par
/OPERATIONS TAB\par
Collation:\cf4\b utf8_general_ci \cf0\b0\par
\par
WITH MY TABLE SELECTED UNDER:\par
/OPERATIONS TAB\par
\b Collation \cf4 utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY COLUMN SELECTED UNDER:\par
\par
\b Collation \cf4 utf8_general_ci \par
\par
\cf1 /*********************************************************************************************************/\par
/*********************************************************************************************************/\par
/*********************************************************************************************************/\cf0\fs32\par
\cf4\fs28 CONFIGUARION WORKING 1\cf3\fs20 \fs24 THE BEST FOR SORTING FOR AN ESPECIFIC LANGUAGE\fs20 . \fs24 IF YOU ARE SURE ABOUT WHICH LANGUAGE YOU WILL USE AND YOU KNOW THAT THERE WILL BE NO OTHER LANGUAGE, ITS A GOOD OPTION. \fs20\par
\par
FOR SEVERAL LANGUAGES YOU WILL NEED TO MAKE ONE COPY OF THE SEARCHABLE COLUMN FOR THE USERS (LIKE USER NAME COLUMN) FOR EVERY LANGUAGE THAT REQUIERES A NEW COLLATION. IN THIS WAY YOU DONT NEED ESPECIAL COLLATION-QUERIES FOR EACH LANGUAGE, YOU \cf0\b0 ONLY NEED TO CHANGE COLUMN SELECTION FOR EACH LANGUAGE.\cf3\b\par
\par
FOR EXAMPLE, USERNAME COLUMN WHEN USER SEARCH USERS...COULD HAVE ONE USER COLUMN FOR SWEDISH-DANISH, ONE USER COLUMN COPY FOR SPANISH, AND SO ON FOR EVERY NEW LANGUAGE, A NEW USER COLUMN WITH A NEW COLLATION ...\par
\par
THE USERS WILL REGISTER WITH LANGUAGE SO YOU KNOW WHAT TO SHOW THEM WHEN THEY SEARCH.\par
\par
EVERYTHING ELSE BUT THAT COLUMNS CAN BE \cf4 utf8_general_ci \cf3\par
\cf0\b0\par
ALL \cf4\b utf8_general_ci \cf0\b0\par
\par
AT HOME UNDER\par
General Settings \par
Server connection collation Documentation = \cf4\b utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY DATABASE SELECTED UNDER:\par
\par
/OPERATIONS TAB\par
Collation:\cf4\b utf8_general_ci \cf0\b0\par
\par
WITH MY TABLE SELECTED UNDER:\par
/OPERATIONS TAB\par
\b Collation \cf4 utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY COLUMN SELECTED UNDER:\par
\par
\b Collation \cf3\fs48 utf8_spanish2_ci \cf4\fs20\tab\par
\par
\cf0\b0\par
\par
\par
\cf4\b CONFIGUARION WORKING 2 JUST FOR SHOWING HOW YOU CAN MIX SEVERAL UTF8\cf0\b0\par
\par
AT HOME UNDER\par
General Settings \par
Server connection collation Documentation = \cf4\b utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY DATABASE SELECTED UNDER:\par
\par
/OPERATIONS TAB\par
Collation:\cf4\b utf8_unicode_ci\cf0\b0\par
\par
WITH MY TABLE SELECTED UNDER:\par
/OPERATIONS TAB\par
\b Collation \cf4 utf8_general_ci \cf0\tab\par
\par
\b0 WITH MY COLUMN SELECTED UNDER:\par
\par
\b Collation \cf4 utf8_unicode_ci\cf0\par
\par
\tab\tab\par
\b0\par
\par
}