Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Sorting Chinese, Japanese


I have been asked to look into support for sorting non-latin 'alphabets' such as Chinese and Japanese. I already know that MySQL supports UTF-8, though my interest is in finding out how well MySQL support sorting of entries for these writing systems and what supplementary configuration I may need to do.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Japanese Characters And Jsp
I am building a site for a client in both japanese and english. I was wondering if anybody could give me some basic pointers or can direct me to a tutorial online. I am using tomcat 5.0 and MySQL 4.02.

The research that I can find has let me to believe that I need 4.1 to support full unicode or there are hacks that will do it in lower versions such as defining varchar column types as binary. I've done this and still have problems viewing or returning data correctly. I wish that i could upgrade to 4.1 to make my life simpler, but my hosting company will not do the upgrade for some time.

I am wondering if there are things that i need to do to my java query? Is there a way around this where i can use the same query and dataconnector class that i have now to return japanese and english?

Mysql 4.1.14 With Japanese
I am using mysql on Gentoo Linux. Until yesterday I could use Japanese messages with mysql with phpBB without any problem, but since I upgraded mysql to 4.1.14, I cannot handle Japanese characters properly (maybe 4.0.xx or something..).

For example, if I try to enter Japanese strings into phpBB, it says:
-------------------
Could not insert new word matches

DEBUG MODE

INSERT INTO phpbb_search_wordmatch (post_id, word_id, title_match) SELECT 3, word_id, 0 FROM phpbb_search_wordlist WHERE word_text IN ('テスト')

Line : 251
File : functions_search.php
-------------------

I think this is due to lack of Japanese support on my server. How can I do it? I want to use ujis and preferably utf-8 also...

Japanese In MySQL
When I try to store Japanese characters in my mysql database, I do not
get the correct characters. The entry of the field is "???" instead of
the Japanese character. I tried to store the character with my java
application and with the MySQL Control Center. I know I have to
configure the mysql database. But I do not know how. I created my
database with the following sql statements:

CREATE TABLE vocab
(
Japanese VARCHAR(100) CHARACTER SET utf8,
German VARCHAR(100) CHARACTER SET utf8
);

But this did not work.

Chinese Chars OK
I have mysql 5 and php 5.1.2 with chinese chars in utf8 on mysql.
Browsing the tables in phpmyadmin shows correct chinese characters.
However, a custom php page to display them shows only ???

At the top of my php page I did include:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Japanese Character
In my mysql database i have stored accounts name in japanese character. All accounts has been displayed in a page sort by name. So i use "ORDER BY name" in my query. But my client complain that the names are not sorted correctly.
Is there anything i have to do in case of japanese or non-english character sorting?

Japanese Char
I am not able to store Japanese chars in mysql database. what should I do to work this out ?

Chinese Characters
I use 'LOAD DATA INFILE'.
bUT can not load Chinese characters from a txt file to a table

Importing Chinese Characters
I've got a problem with importing chinese characters into a mysql-table
and have read several mailings but didn't find a solution.

i have a utf-8 text file that contains chinese characters. the table
where i want to import the data using "load data local infile" has
collation utf8_unicode_ci. but after the import is done, the chinese
characters are converted into so strange characters. to show the
chinese symbols in a php-script i use mb_convert_encoding() which shows
me the characters properly, but the problem is that i have to order by
the col that contains the chinese characters, so the chinese characters
mustn't be converted after importing. when i use the form in phpmyadmin
to add data it is possible to store the characters properly. is there a
way to achieve this by using load data local infile?

Can't Insert Chinese Characters
In my local machine, I am using:
ASP.NET 1.1
MySql 5.0
MySQL Connector Net 1.0.6

I can retrieve and update tables contain Chinese characters without problems.

But when I pushed everything into the hosting site, I can retrieve but can't insert or update Chinese characters. It will show "?" instead.

The hosting site is using MySQL 4.1.14.

Importing Japanese Characterset
I`m trying to get a mixed excel spreadsheet (English and Japanese) into mySQL. I thought phpMyAdmin could do it, but it can only export into an excel file.

The issue I have is, there is something weird about the csv file format in that it makes all my Japanese text become garbage. So I`m thinking I need a way to import directly from the xls format.

Does anyone have any experience inputting asian languages/charactersets into mySQL? I would prefer to use OSS or free software (it is a project for education = limited funds).

MySQL Japanese Characters
I use a MySQL Database where I store Japanese characters in SJIS. I tested if they are in SJIS and they are.

I am using mysql 4.1.3b-beta, mysql-connector-java-3.0.14, JBuilderX (jdk 1.4.2), and OS XP.

I change the default encoding latin1 to sjis when I start MySQL. I use
mysqld-opt --default-character-set=sjis
mysql --default-character-set=sjis.

After starting mysql with the sjis character set I used:
create database japanese;
use japanese;
create table jp (jp1 varchar(100));

I use a file with sjis characters as input. And to see if the output is in sjis I write the values to an output file. The values I get are in sjis.

(I can't set the character set of the table to sjis. When I do that I only get garbage into the database and in the output file, maybe that's becuase I already changed the default character set at start-up?).

So I have no problem with inputting a file that contains sjis characters and I can also output data to a file in sjis when using only MySQL, but I can't do it with Java.

When I try to retrieve the data I only get a square, then a some character, then a square, then another character,... but not the actual kanji/kana. I have some latin characters in the same column as the kanji/kana and they are displayed correctly. I already tried only using kanji/kana in a column but it didn't work either.

I can display Japanese characters correctly in Java when I retrieve them from a file, so I don't think it's a problem with the font. I also tried outputting the data I retrieve through Java to a file but there I get the same symbols as in my JTable.

Have I done something wrong with creating the Database?
Is there something I need to consider when using the MySQL Connector?

On a side note as I am new to MySql after installing version mysql4.1.3b. I no longer have the mysqld.exe but only mysqld-opt.exe. So I am using this instead. But I don't think that can be responsible for my problem.

Can Input Japanese, Can't Pull It Out
I figured out how to store Japanese characters by setting the collation of a particular field to utf8_bin. I can input Japanese characters, and I can see them just fine under PHPMyAdmin.

The problem is that when I execute a query and print them to a web page, all I get is question marks instead of Japanese characters. This is while using the same browser that allows PHPmyAdmin to display the characters correctly.

I added the following metadata to the <head> portion of the document but it didn't help:

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

Chinese Characters - UTF8
I am attempting to store Chinese text in a table with UTF-8 encoding and utf8_general_ci collation.After being stored, they are retrieved and displayed on a web page.On that page, which is properly set to use the UTF-8 character set, about 95% of the characters are correct, but a few are replaced with question marks and boxes.

the fact that most are correct indicates to me that my settings are correct in all places, but perhaps the UTF-8 Character set is incomplete.

Characters that work fine (Hex):
? (C3A5CB86E280BA)
? (C3A9E282ACC2A0)
? (C3A7C5B8C2A5)
? (C3A7E280B0C592)

Characters that are not working (Hex):
? (C3A53F3F)
? (C3A5E2809C3F)
? (C3A6CB863F)

I am using ColdFusion MX 7 and the MySQL ODBC connector on a Windows machine. This is a shared hosting environment, so I may not be able to upgrade anything.

Displaying Chinese Characters
I install MySQL v4.1.14 in WindowXP as a service. I store all the data in the plain text file and load it into the database. All the data are stored in the database successfully but all the chinese characters become '????'

Every time I need to set the character set to big5 before I can see the chinese characters in the command line interface. How can I set the big5 as the default character set?

Although I can see most of the chinese characters after setting to big5, some of the characters are still in '????' Why this happens?

Thirdly, even if I can see the chinese characters in the command line interface, all the chinese characters change back to the '????' again when I use the web browser to see the data. How to fix up this problem?

Displaying Chinese Characters
I am designing a website that needs to be bilingal English/Chinese. I decided to create a MySQL table to hold page contents with a field called language with values en or cn.

I have two PHP pages, one queries on all records with en and has a character set "iso-8859-1" the other queries on all records with cn and has a character set "gb2312".

I have decided to enter the data using an Access database linked to the MySQL database using MyODBC. When I enter english characters all works fine. when I enter chinese charcters, they initially display fine on my PC as chinese characters, but once the record has been entered these are replaced with ?? symbols.

The question marks appear to originate from the MySQL database because they show up in the Access database, the online chinese page and using PHP MyAdmin.

Search Chinese Simplified
Hello, everyone. I would like to ask something about searching Chinese simplified characters from the database. Every time I searched, it won't display data,but if I searched without a condition it displayed all data including Chinese simplified characters.

Databasing Chinese Content
My company is looking into developing spanish and chinese versions of their website. Building a custom content management system seems to be the best route for this but I'm curious as to MySQL's ability to database chinese (and other non alphabetic languages like arabic and japanese) content.Has anyone dealt with this issue or have a recommendation on another database platform I could use that offers support for this requirement?

Chinese/Unicode From Php And Mysql
I searched the forum regarding this problem already and attempted to solve the problem, but fail regardlessly.I entered chinese characters directly into a table column A which has collation utf8_unicode_ci using phpmyadmin. The chinese/unicode characters actually appeared in phpmyadmin's "select * from tableT".

However, when I create a php script with a query "select * from tableT", it appears in the form of question marks e.g. ????.Any idea how to resolve this? If I can view the chinese characters in phpmyadmin via the web browser, it shouldn't be a problem to display it in a php file, right? Not sure whether this is a php or a mysql problem.

Entering Japanese Characters
Edit: Inserting it into the database manually works, so its entirely possible this is just a problem with php reading it and inserting it wrong. I'm just going to post this in the php section,

Can Not Load Chinese Characters
I use 'LOAD DATA INFILE' syntax to insert records into a table. The txt file contains Chinese characters.After executing the command,there was no error dsplayed,but the Chinese characters were not inserted into the table,instead there was blank when I typed 'select * from table'.

Can't Enter Chinese Characters
I have tried to follow instructions online as well as other threads in this forum, so far to no avail. I am using JSP, Java 1.4, MySQL 4.1 and Tomcat 5.5 on Windows XP.
1) I have set my JSPs to use UTF-8 wherever possible. I have a form where I can enter Chinese characters into a form, which hits a servlet, but text always arrives to the servlet garbled.
2) When I try to directly do an INSERT to a column and insert a chinese character, it comes up as ??? mySQL Query browser says "Data truncated to column 'translation' at row 1' ErrorNumber 1265.
3) I have made sure that each table's encoding is UTF-8.
Not sure what else to do. I can't find any easy instructions to do this. If you know of one,

Unicode And Japanese Support
I am using cold fusion to make a small custom website using
mysql to store the information a user inputs. I want it to
be able to save japanese and unicode text, but whenever I
enter any it comes back as garbage. Is there anything
special I need to do to configure mysql to use unicode

Store Chinese Character In Mysql
My site is 90% english, however there are some pages that i need to display in chinese character. In fact, arabic, russia, spanish. In mysql, i try to use collation utf8_general_ci . So when i input the data using phpmyadmin, i type chinese character e.g (lucky) into the record, save it. Unfortunately when i use php to get the data from mysql database and present it on the web, it appear as '?' (question mark). How do i show it on the web correctly ?

Storing Japanese Text In MySQL
I am developing a site for a Japanese jewerly business in PHP and I'm having a problem with getting the japanese text to store correctly in MySQL. I've been working on this problem for three days now and after an exhaustive internet search and countless coding/database collation changes, I'm still stumped. I've seen a number of forums suggesting the use of SET NAMES 'utf8' or SET CHARACTER SET 'utf8',

I've tried these and more with no success. Does anyone have any suggestions? One other thing I noticed - when I type japanese text directly into the database table field, the text gets converted to these: &#27700; - which looks odd but displays as the original japanese text when querried from the database and displayed in a web page. Is there a way I could convert my text to this format before inserting it?

Japanese Text Dump To Table
I'm trying to upload the content of a TXT file in Japanese (JSHIFT) into a table with the command LOAD DATA INFILE, but everytime I've tried, I receive a warning that the text is being cropped and then it doesn't display properly on my webpage (although it's encoding is properly set with :

<meta content="text/html; charset=Shift_JIS" http-equiv="content-type"/>).

I'm tired of trying, so I decided to ask in case anyone has experience with text in other encoding formats.

How To Save Chinese Record In MySQL?
I am now using MySQL database to save Chinese, my OS if Chinese Windows2000, and my MYSQL version is 4.2, but I couldn't save some Chinese characters at all, some can be saved, others are lost or displayed in a mass, you won't understand the meaning at all.
Can anyone tell me how to solve this problem, how to save Chinese informaiton in MySQL?

Is MYSQL Supports Chinese Language
Is Mysql support chinese language or not.

How To Show Chinese Character Correctly?
i'm using Mysql5.0 now, it's char_set is latin_1 and my os is WinXP Chinese Edition. In my tables, chinese characters can be shown correctly from mysql command line, but chaos when i use mysql GUI tools and phpMyAdmin. what's wrong? what should i do ?

Store And Read Chinese Characters
I'm writing a vbscript application that reads UTF-8 XML containing Chinese
characters. Any suggestions how to store these characters in MySql 4.0.x ?

Do I need to set a special encoding such as Big5 on the database ?

Does MySql support storing UTF-8 ? If so what data types / encoding do I
need to use ?

Are there any special considerations for using MySql/ODBC and ADO to get and
put the data.

Save Both Japanese And English Characters
I will try to explain you what is my trouble:

I am not be able to write in my database using asian characters:
1) &#12513;&#12483;&#12475;&#12540;&#12472;
2) &#51228;&#50808;&#54616;&#44256;
3) &#1072;&#1085;&#1080;&#1090;&#1100; &#1087;&#1072;&#1088;&#1086;&#1083;&#1100;
4) etc.. .. ..

I have a trouble using in my database asian characters.


When I copy and past them on my forum, I see that:
1) 分対
2) じませ
3) にフォー


I think that I have to set up my mysql in a different way.

I would like to know that:

How I have to do for saving both european characters and asian characters?
What version of mysql I have to use?
What are the character_set and the collation that I have to use ?

Japanese Characters In MySQL 4.0 - Character Sets?
How do I insert Japanese and other foreign characters into a MySQL 4.0 table? (4.0.27 to be specific) In other words, how do I specify a UTF-8 set for a database or table or column. MySQL 4.0 doesn't seem to support character set definitions the same way that 4.1 does, and I'm having trouble locating how to do it in 4.0.

Right now if I insert Japanese characters they show up as character codes like '& #25658; & #24111;' (without the spaces) in the table. While this displays properly if used to make content on a page, I'm not sure if a search engine will pick it up right.

How I Can Save Both Japanese And English Characters, In My Text Box?
I will try to explain you what is my trouble:

I am not be able to write in my database using asian characters:
1) &#12513;&#12483;&#12475;&#12540;&#12472;
2) &#51228;&#50808;&#54616;&#44256;
3) &#1072;&#1085;&#1080;&#1090;&#1100; &#1087;&#1072;&#1088;&#1086;&#1083;&#1100;
4) etc.. .. ..

I have a trouble using in my database asian characters.


When I copy and past them on my forum, I see that:
1) 分対
2) じませ
3) にフォー

I think that I have to set up my mysql in a different way. I would like to know that:

How I have to do for saving both european characters and asian characters? What version of mysql I have to use? What are the character_set and the collation that I have to use ?

Japanese Table/Field Names In MySQL
I have come up against a problem when converting a Japanese database from MsAccess to MySQL.

Using the export function of MsAccess to transfer the data to an MySQL database, I find that when I view the MySQL table from the MySQL Control Center the Japanese double byte characters have been converted to gibberish. I have tried changing the display properties to display using Japanses fonts but the problem remains.

Is it possible to export tables/fields names which contain Double Byte Characters into MySQL and if so what do I need to do ?

Importing Japanese Characters From Text File
I have a tab-delimited text file I'm trying to import with Navicat Import Wizard. The first field of each line is in Japanese (SJIS format). Even though I've tried setting up the fields with Design Table for the field of the new database to be coded for SJIS (and every permutation I can think of), I only get question marks in the generated table.

Storing English/Japanese/Russian Characters
what is the best collation to be used for a field that will hold characters from various languages. It could be a set of characters from any of the following languages and different rows could hold different languages:

* English
* Japanese
* Russian
* Spanish
* Portugese
* German

The Most Optimize Way To Store And Seach Chinese Character In MySQL 4.1
Currently i store the chinese character in unicode decimal format
(&#<number>;). In this way, I can display and search the chinese
character correctly. However, this will take more storage space. Is
this the most optimize way?

How To Store Chinese Chars And Also Italian, French And English In Mysql ?
I'm not able to store chinese characters into a column in a table....

how should the db setted and the table created to be able to store
different chars like chinese, french, italian and english ?

MySQL LOad Data Infile Problem With Japanese Characters In Linux
I am trying to import a data file wich has japanese characters (sjis encoding). I am having problem loading the datafile into database using LOAD command in linux. The same command works on Windows though (Reagion set to Japan, Language Japanese without using any of the settings.

I have created the database using character set set to sjis. Table type is InnoDB and char set is sjis.

My MySQL server version is 5.0.16 on RedHat EL 3.0 AS (English and Japanese language support). I have set the following sys variables;

Sorting
I have a database with 5 teams and each team has 'n' categories and each
category has 5 sub-categories.

i.e TeamOne = Ottawa, Category 1 = Player Name, Sub-Categories = Goals,
assists, ppg, gwg, points.

Team0ne
Category 1
Sub 1
Sub 2
Sub 3
Sub 4
Sub 5
Category 2
Sub 1
Sub 2
Sub 3
Sub 4
Sub 5
Etc.

From the examples above I am trying to add the all the sub-categories
together for each category for each team in descending order.

To put it simpler - I want a total of all the goals scored for each team
and display them in descending order. I have been able to put a query
together that gets me the totals, but I can not get them in decending
order.

The query below is in a for loop in PHP and cycles through each team and
does give me the totals, just not in descending order (actually the
order is the way they are numbered in the database);

$query = "select team.name, sum(goals) from roster join reference join
team where team.idn=reference.idn and reference.idp=roster.idp and
position = 'F' and team.idn = 1 group by team.name";

Sorting
I have two columns, one is an int and the other is a date, I want the records to show first the null values in the int column and have that sorted by date, then the rest of the rows sorted by date.

I tried doing

order by int asc, date asc, but it only orders the null values properly.

so this should be the result:
date, int
3/12null
3/13null
3/85
3/94
3/104
3/115

Sorting
I need to sort a query's results from a database and I only want a particular value to be first. So if any of the query results equal "text" (the string) I want them to be the first values returned.

Sorting Twice
I want to sort my query by date then by name. Right now I'm using:

SELECT * FROM `race_calendar` order by date asc

How can I add the second sort?

Sorting
I am currently developing a used car website. When a user browses our inventory it displays the cars to him by the id it was entered, IE when entered into the database each car is assigned a number 1 , 2 , 3 so on. When the browse button is clicked it only sorts the vehicles by Car ID#. Is there anyway I can have it sort by price , or year , or make? Is the sorting in the database or in the scripting?

Sorting By Value
How can I fix this?
Using the following to select and sort:
$query_land = "SELECT id, type, estate, parcel, asking, zoning, `size`, selling FROM sold2005 WHERE type = 'land' ORDER BY estate ASC, selling ASC";

Sorting
Is there anyway to sort in a different order in mysql than it usually does. Here is an example.

m100
m20

Mysql will order them in that order but the problem is that m20 should come before m100.

Not Sorting
some how my query is not sorting ASC or DESC, what am doing wrong?
Code:

SELECT DATE_FORMAT(jdate, '%a. %M-%d-%Y') as jdate, jid, jtitle FROM hrjobs WHERE jstatus ='on' ORDER BY jdate ASC

Sorting
Is there any way to sort a field in mySQL db when items are inputted into the DB, so they are sorted in the actual DB. I know they can be sorted easily in PHP on the client page, but I am not sure if there is any way for the DB to actually sort them. (It would be a numberic field, int).

Sorting
i have a mysql db of about 300-400 users which is used for a game, part of an update i'm working on is rankings, i want to know is there an easy way to sort the results of a SELECT query, so highest score first, lowest score last and then find what position 'user' is within the table?

Advanced Sorting
SELECT
a.asset_id,
CONCAT( a.subcategory_id, '-', a.asset_type_id) AS sort_key,
SUM( av.vote ) as rank
FROM
asset a
LEFT OUTER JOIN
asset_vote av
ON
av.asset_id = a.asset_id
WHERE
a.status = 1 AND
a.school_id = " . $SchoolID . "
GROUP BY
a.asset_id
ORDER BY
sort_key,
rank
LIMIT 100

I am working on a query and we would like to pick 100 assets.

I would like one of each asset_type for each subcategory sorted by the highest rank. If there are only 3 subcategories and 3 asset types, that means I have 9 assets. If we have picked the "top" asset already it should go through the query again and pick the second one.

I need to put 100 assets through, so if we run out, I would like to move to pull more from a different category.

Any help from here? I am thinking of trying a group by on my sort_key?


Copyright 2005-08 www.BigResource.com, All rights reserved