Extract Unicode Data From MySQL Db

Jul 17, 2005

I have a little, big, boring problem :)

I have a utf8 txt file to import in a MySQL db, cause I must create a
web-application in PHP for reading this information on-line.

I have create a new DB in MYSQL 4.1.1a setting CHARACTER=utf8,
then I have create a table t1 with character set utf8 and some fileds
also with CHARACTER=utf8.

Then I imported the Txt file (really in UTF8 format, with 22600
records!) in my db. MySQL have imported the non-utf8 field correctly,
26000 records.
When I try to read this utf8 filed they appear like "?-?-?".

Then, also my PHP application show this field with stranges
characters. I have try also with PHPfunction utf8_encode with no
success :(

View 2 Replies


Accessing Unicode Data From A MySQL Database With It

I am a training developer in .NET and web 2.0 technologies and this one is an exercise from one of our first lessons in PHP: accessing a MySQL database from a PHP script. The problem I've encountered is that while database is thought to be in Unicode (i.e. the values contain accented characters, as this exercise is in French), the PHP script result in garbage characters (actually just one, a enlongated rectangle).

The exercise consists of a PHP script and a MySQL database with two tables where the script queries all entry data from one column in just one table (so no joins necessary). The MySQL table is called "Restaurant" - well, actually this side isn't that much important yet. (Which means I'll come back to that later.)

$myQuery = "SELECT LibPlat FROM Plats";
$rs = mysql_query($myQuery);

My setup consists of Eclipse with PDT and Zend Debugger (latest version, i.e. 3.5.1 and just updated). I use Zend Server CE with its MySQL install (phpMyAdmin). Basically the script does just what I've been asking it to do, except that the French accents (like in thé or café) don't appear (there's this rectangle instead).........

View 7 Replies

Jquery: Ajax Retrieving Unicode Data From MySQL

i managed to SAVE unicode data using jquery ajax call, but when i try to retrive back using jquery and ajax i cant pass array of unicode data using json_encode, the unicode data were changed to NULL from my php page, this one give back the same data


in my jquery page


if i add json_encode, the result in my jquery call is NULL


in my jquery page


View 1 Replies

Insert Unicode Data Into Mysql Using Script From The Command Line?

I am running this php code from command line that fetches text (may contain unicode characters) and insert into a mysql table. I verified that the php variables have the unicode text, but when it does an insert, the table columns are blank. I can accomplish the same with an html form without any issues. The table charset is utf8 and i use set names utf8 before the query.

View 1 Replies

MySQL 5.0, FULL-TEXT Indexing And Search Arabic Data, Unicode

MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode

[This version has a couple subtle edits from the orginial I posted
on mailing.database.myodbc - I'm cross posting here on this
topic/subject related newsgroup]

I was wondering if anybody has experienced the same issues
challenges I'm experiencing I'll describe shortly. Once
resolved some fascinating and powerful multi-lingual
apps incorporating non-English/latin character sets can be
realized by many developers.

I have a Unicode utf8 English - Arabic - Hebrew - Greek (and
several other languages) database in Microsoft Excel. I KNOW
that it is Unicode utf8 data because MySQL tells me it
recognizes the encoding as such but not in the context I want.

Allow me to explain ...

I can search the Unicode utf8 encoding with no problem in
Excel. While in Excel I highlight a complete word or a
partial string of an Arabic word copy it to the clipboard
(i.e. memory). I then do a find and the process is the
same successful result as if it was an English string.

MySQL 5.0 is supposed to handle Unicode utf8

I created a MySQL database I named: languages


and I implemented the following command on a MySQL
command prompt:


No problem (so far) MySQL seemingly recognized utf8 and
accepted it. My understanding is with the ALTER command
the tables I create against languages will be utf8.

I now created a table I named mainlang which denotes it
will be the main table for my languages.

mysql>CREATE TABLE mainlang
->langNumID varchar(30),
->colB varchar(30),
->colC varchar(30),
->primary key (langNumID, colB)

Again so far no problem: Table successfully created.
My third column 'colC' is where the Unicode data
will be stored.

I now attempt to import the database from my
Excel file into my MySQL database as follows:

mysql>load data infile 'c:arabicdictionary.csv'
->into table mainlang
->fields terminated by ','
->lines terminated by '
->(langNumID, colB, colC);
ERROR 1406 (22001): Data too long for 'colC' at row 1

So what to do? I did a search and found other
people seemingly had the same problem and someone


I dropped mainlang, recreated it, redid the load and
Lo and behold ... it seemed to work. No Data too long
error occurred and when I did the following query:

mysql>select langNumID, colB, colC
->from mainlang
->where colB = &#55617;&#57074;'

I see colA have a correct numeric value, colB a
correct numeric value (4994) and for colC a string of
unintelligible characters with diacritical marks,
oomlats etc. which I know is the cp1250 encoding
interpretation of the Unicode utf8 data which is
similarly unintelligible in its own regard.

Now what I try is: do a copy of the obscure colC
cp1250 character string into the clipboard/memory
and then do the following tweak on the original
select statement to see if I can search on the
(now) cp1250 character string:

mysql>select langNumID, colB, colC
->from mainlang
->where colc = 'paste of the cp1250 character string'

The computer would not allow a paste unless I pressed
the escape key. On initiating this select command
I got an empty set (no match)

My questions are:

Has anyone been successful creating a Unicode utf8
MySQL database that accepts Arabic?

If yes, how did you get around or not encounter the
Data too long issue?

Have you tried the cp1250 (or cp1251 - same mechanics
same results) work around as I have? Are you
able to search the cp1250 character string (my colC)?
If yes, how did you successfully manage to do it?

Lastly, if I take the cp1250 encoded string and paste
it into Excel ... I can string search the cp1250
encoding with no problem.

Also, here's how I know my Unicode utf-8 data is
correct apart from my own manual cross-referencing
and being recognized by MySQL in some respect:

When I copy the Unicode utf8 encoding and try to
paste it into the select command to see what would
happen I get the following error:

ERROR 1257 (HY000): Illegal mix of collations
(cp1250_general_ci, IMPLICIT) and
(utf8_general_ci, COERCIBLE) for operation '='

So what I have here is a situation where MySQL
is recognizing Unicode utf8 encoding but not
from the respect of packing a table!

Go Figure ...

View 1 Replies

MySQL Data - Extract Data From 2 Different Sources?

I've got my pagination script working, but now I m trying to get it to extract data from 2 different sources.
The episode data is stored in table episodes, whilst the main table (where the info on airdates for episodes is stored in epdata2).

This is my code:

* PhpMyCoder Paginator *
* Created By PhpMyCoder *[code]....

Basically, what I'm trying to do is select certain records from the episodes table, and have them with certain airdates, stored in the datetime format, similar to this:

2010-04-26 13:00:00 13:30:00 Episode 1
2010-05-04 00:15:00 00:50:00 Episode 2

I'm trying to get it to remove the record after it expires (i.e. hide it) - one bug I found today was the event disappeared during it, at 10:09am it did not show, despite the fact the event expired at 10:30am. (this is UK time, GMT).

View 1 Replies

While Loop To Extract Data From Mysql

I am using the following code to extract from mysql a users shopping basket. What i want to be able to do is to get all the information that is displayed by the while loop and be able to submit all that information in a hidden file:

ie <input type="hidden" name="desc" value="$whatever"> $whatever being the information generated by the while loop.

while ($row=mysql_fetch_array($sq1_result)){

View 6 Replies

Error In Php For Mysql Data Extract

What is wrong with this at line 15 ( } else { ) error out. Im trying to pull data from database and display on page. It all worked till I added the if( . Also I need some idea about how to keep this output sheet a little more current.

What I mean by this is the current code desplays by Race_date desc, How would I get it to remove anything older than say 2 weeks. Code:

View 8 Replies

Failed To Extract The Data From Mysql Db?

I have a bit of trouble as I am trying to extact the data from mysql database when I enter the url as something like this:


PHP Code:

define('DB_HOST', 'localhost');
define('DB_USER', 'myuser');
define('DB_PASSWORD', 'mypass');
define('DB_DATABASE', 'mydbname');


View 3 Replies

Extract Data From Pdf & Enter Into Mysql Database?

how to extract data from pdf & enter into mysql database in PHP.

View 4 Replies

Separate Extract Data From A MySQL Database

Is it at all possible to extract date from a MySQL database with a while loop and assign each value extracted to a new unique variable?

View 1 Replies

Extra Backlashes - Extract Data From Mysql Table

I have an issue that when I extract data from mysql table it's including backlashes with quotes. Example if I enter "james" in the table when I extract the data I get "james" Is there a function to correct this issue? This is a remote server and I don't have access to the PHP.ini file am using the code below to enter a value into the table


I am using the follow code to retrieve the data

<?php echo $row['value_name']; ?>

View 2 Replies

Extract Data From File Save Into Mysql Database?

This should be a code igniter based class,The table header should be Price Percent_change Company Name Company Code Volume

View 2 Replies

Preg_replace With Unicode Chars - Allow Only Numbers / Letters And Unicode

I've a question similar this question: php preg_replace In that question, He/She want to allow only letters and numbers and _, but I want to allow only numbers, letters and Unicode (non-latin) letters and numbers (I think, I should use the Unicode values of this (for example U+1F70)).

View 1 Replies

Echo RAW Data From Unicode Page?

How can I print raw data (string) from a UTF-8 .php file?


echo $var

ouputs unicode string to browser (with unicode prefix bytes), but if I
want to ouput BLOB data (jpeg file)?

View 2 Replies

Display SQL Server Unicode Data?

How to display SQL Server Unicode data


View 2 Replies

Losing Unicode During Passing Unicode Char?

I want to store in array pairs of unicode chars (char, number of instances of the char), but I have some problem with passing unicode chars:

This code:



array(6) {
string(1) "�"


and for me it is a result, which I want to achieve.

EDIT: Replacement for str_split (length=1) for unicode chars:

function mb_str_split( $string ) {
# Split at all position not after the start: ^
# and not before the end: $


View 1 Replies

MySQL 4.1 / PHP 5.0 : Unicode Problems

I have been trying to build a website that has multilingual support
using the LAMP setup. I have created tables that store language
information and correlate different strings ids with languages. The
strings are all VARCHAR with unicode (utf8) encoding.

I have tried all the ways that I could think of and I have checked
every website to no avail. What I am trying to do is simply open a
connection to the database (using mysqli) and query the tables for one
unicode string entry. Then I call fetch_object on the result and print
it to an HTML document. This fails with me. The characters I see are
not unicode but either ??????? or some weird character. Aparently the
encoding turns out to be ISO-8859-1.

I have done the following:
1. Create the entries in the MySQL tables as unicode in InnoDB tables.
Unicode text shows up properly in phpmyadmin.
2. Query correctly to the best of my knowledge using mysqli.
3. Add the proper header encoding to the http header and add this meta
tag to the html:

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

Everything I have read says that this should work even though PHP is
notorious for unicode support. What I have been able to narrow down the
problem to is that the string that I get back from the database is
latin encoding. I know it is unicode from MySQL (phpmyadmin), so I
assume the problem lies in the mysqli_query function call or with the
fetch_object call.

View 3 Replies

Json_encode And Mysql Unicode?

i have the following javascript code:[URL] Which works fine(the makewindows function has been changed to show it is a php variable), however the html contains unicode characters, and will only be assigned characters leading up to the first unicode character. If I make a small test file and echo out article_desc directly, all the html is output, although quetsions marks are displayed instead of the correct symbols. However json_encode seems to cut short the html, resulting in errors.

edit: here is a dump straight from the mysql database of the html I am trying to display:[URL]

it says utf-8 in the source. the actual page code generated from echoing out article_desc is here:[URL]

it is definitely the same record, so I am unsure why it seems to very different.

edit: this was fixed by calling: mysql_query('SET NAMES utf8');

View 4 Replies

Unicode Form Data - How To Obtain Character Codes?

We have a form through which unicode data might be submitted. We need to be
able to detect when this happens and, most importantly, we need to be able
to obtain the unicode character codes for each individual letter/symbol.

Is this possible in PHP? If so, can you please provide a short code snippet.
We looked at the mbstring extension but found nothing helpful, especially
since the documentation is less than satisfactory.

View 1 Replies

Access A MS SQL 2000 Database With Unicode Data In Nvarchar Fields?

We need to access a MS SQL 2000 database with unicode data in nvarchar fields from PHP (on IIS). nfortunately PHP's MSSQL does not support this. Unfortunately we cannot use a different driver (like ADODB) - we're stuck with the application (Interspire KM) and can't rewrite it. Is there anyway to get PHP's MSSQL driver to talk to Unicode databases?The error message when we do UPDATEs is: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC versionGoogling for a solution turns up the suggestion that we revert to varchar. However, if we do this, special characters (like "ü") get stored incorrectly and the search does not work so this is not really a workable option.

View 2 Replies

Import Excel To Mysql Unicode Issue

i have a script which you can view below that will import a .csv file into a mysql table, however i get errors due to the various special characters in the spreadsheet. is there anyway i can get around this. Code:

View 1 Replies

Unicode Characters From JSON.stringify To Real Unicode Characters?

I use JSON.stringify() function to stringify JS objects for AJAX sending to PHP. The problem arises when JSON.stringify function encodes unicode characters to format uxxxx (eg. u000a). My question is how to convert those characters to regular unicode characters in PHP?

View 1 Replies

Extract Data From XML

I am trying to set up a very basic CMS using PHP and XML files. What i need to do is extract specific data from the xml file to display on each page. ie when the user clicks a link the php reads and sorts the xml file to retrieve the required data to display.
eg: We have an ID tag in the xml file, when a user requests the item with that id we would like to search the file and simply return the data for that id attribute.
Can anyone suggest a quick way to do this using PHP?

View 5 Replies

Extract Data

Is it possible for PHP to parse another wesite and extract some data from it? For instance, I have a website that sells gold jewelry and i would like the price of the jewelry to change based upon the price of gold that day.

I want to get the price of gold from a different website by parsing its page and extracting the price and then do my caculating in PHP and display the new price automaticaly each time the page is loaded. Is this possible?If not,what language would I need to use?

View 2 Replies

How To Extract XML Data

I am required to extract the information at a particular "area" of this large collection of xml. But i'm not familiar with extracting xml. I've looked through the site and tried various ways but all i get back is "Error in my_thread_global_end(): 1 threads didn't exit"Here's the url of the xml i'm getting my data from:ftp://ftp2.bom.gov.au/anon/gen/fwo/IDV10753.xmlI would to retrieve all the 7 forecast-period located only for the Swans Hill "area".

View 2 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved