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 :(

ADVERTISEMENT

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

Feb 20, 2011

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 View Related

Losing Unicode During Passing Unicode Char?

Mar 27, 2011

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:

[code]...

displays:

array(6) {
[0]=>
string(1) "�"
[1]=>

[code]...

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: $

[code]...

View 1 Replies View Related

MySQL 4.1 / PHP 5.0 : Unicode Problems

Oct 20, 2006

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 View Related

Json_encode And Mysql Unicode?

Dec 8, 2008

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 View Related

Import Excel To Mysql Unicode Issue

Dec 21, 2006

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 View Related

Accessing Unicode Data From A MySQL Database With It

Nov 4, 2009

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.)

<?php
mysql_connect("localhost","root","");
mysql_select_db("Restaurant");
$myQuery = "SELECT LibPlat FROM Plats";
$rs = mysql_query($myQuery);
[code].......

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 View Related

Jquery: Ajax Retrieving Unicode Data From MySQL

Jan 20, 2011

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

[Code]....

in my jquery page

[Code]....

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

[Code]....

in my jquery page

[Code]....

View 1 Replies View Related

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

Dec 27, 2009

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 View Related

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

Jun 13, 2006

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

CREATE DATABASE languages ;

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

ALTER DATABASE languages DEFAULT CHARACTER SET utf8;

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
suggested:

ALTER DATABASE languages DEFAULT CHARACTER SET cp1250;

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 View Related

Unicode Characters From JSON.stringify To Real Unicode Characters?

Aug 23, 2010

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 View Related

Unicode Support - Using MySQL 4.1.7 Collation Utf8 And Char Set Utf8-general_ci

Oct 4, 2005

Subject: We have some problem with utf-8 encoded characters in PHP.

Using MySQL 4.1.7 collation utf8 and char set utf8-general_ci, we are storing German, French, Spanish and turkey, Nederlandâs etc.. Characters, those special characters are storing properly in MySQL.

But when extracting those characters using PHP into variable and want to replace special characters with relevant Umlautâs, PHP unable to recognize the Special characters.

Please let me know reason, why PHP 4.3.11 does not support utf8 8-bit characters?? How do I achieve the replace functionality with utf8 characters in PHP.

View 1 Replies View Related

MySQL Extract BUG?

Jul 17, 2005

Assume a MYSQL table, foo.

One column, bar datetime.

Two rows:
2004-01-01 08:00:00
2004-02-01 08:00:00

select * from foo where extract(day from bar)=1;
2 rows in set...

select * from foo where extract(month from bar)=2;
1 row in set...

select * from foo where extract(month from bar)=1 && extract(day from
bar)=1;
1 row in set...

select * from foo where extract(month from bar)=2 && extract(day from
bar)=1;
Empty set... SHOULD BE 1 ROW!!!

MySQL version 4.0.13, running on Windows 2000.

Am I doing something incredibly stupid, or does this just make no sense?

View 4 Replies View Related

Extract From MySQL To Csv-file

Jul 17, 2005

I need to output data from a number of MySQL tables in a csv-format where I
first have a header line, then a number of order lines, a new header line,
etc.

What I need is advise on a tool to do this for me, as I assume this is not
possible with for examle MS-Access ?

Will a tool like EMS MySQL Query be of any use? Should mention that I am
absolutely not a programmer, but can use php-myadmin, MS-Access etc.

View 4 Replies View Related

Extract Text From MySQL?

Apr 14, 2011

I need to export several records that have large text fields in them and import that into an Excel file. I have a script that creates a tab delimited string that then writes a text file. When importing into Excel the formatting inside the large text files is creating havoc and breaking into many more columns than it should (or at least than I want). I have tried enclosing the text fields with double quotes, single quotes etc.

View 4 Replies View Related

Extract Field Value From Mysql?

Feb 13, 2010

I developing portal script in PHP Smarty Template.

In my portal there are form in that multiple selection option so value of field is submit in mysql.

Now I want to show in display page so how can i extract that from mysql.

View 5 Replies View Related

While Loop To Extract Data From Mysql

Sep 15, 2000

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)){
$code=$row["CODE"];
$description1=$row["DESCRIPTION"];
$cost=$row["COST"];
$quantity=$row["QUANTITY"];
$price=$row["PRICE"];
$total=$row["TOTAL"];

View 6 Replies View Related

How Do I Extract 10 Rows At A Time? Mysql

Jul 2, 2006

How do I extract 10 rows at a time from a mysql database? What code could I use to do ten rows at a time? Say I am trying to get 10 rows and get the lastname field from each.
The code below works for one at a time. PHP Code:

View 3 Replies View Related

Error In Php For Mysql Data Extract

Feb 6, 2007

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 View Related

Failed To Extract The Data From Mysql Db?

May 30, 2011

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:

[URL]

PHP Code:

<?php
session_start();
define('DB_HOST','localhost');
define('DB_USER','myuser');
define('DB_PASSWORD','mypass');
define('DB_DATABASE','mydbname');

[Code]....

View 3 Replies View Related

Extract The Hotlink Images From Mysql?

Jul 22, 2011

I am using two scripts as one are using for to hotlink the images that I have stored in mysql and the other script i am using for to get access to images.php. The two scripts I am using is link.php and images.php. I have got a problem with the images as I am trying to extact them when I enter the url something like www.mysite.com/link.php?user=test. I can't be able to extact the images when I get access to images.php and input the images in my php page. The image data have displayed as empty array.

here's the screenshot:

Link.php
Code:
<?php
session_start();
define('DB_HOST', 'localhost');
define('DB_USER', 'root');

[Code].....

View 5 Replies View Related

Displaying And Extract The Results From A MySQL Database

Sep 26, 2007

I'm working on a page that is meant to take all entries that include the word 'September' in their 'date' field and display them on a page. It's meant to extract the results from a mySQL database, this is what I have so far: Code:

View 1 Replies View Related

MySQL / It Oddities - Regarding Database And Trying To Extract From 2 Tables

Apr 30, 2010

This is my code, as seen here: [URL]

[Code].......

I can paginate, but I'm trying to get data from 2 different databases - namely mytvguide which stores info on what date the programme airs, and episodes which contains a link to a page on the episodes. Also, what I am trying to do is see if I can get all records which are episodes to be formatted like this:

TV Showshowing on Channel1May 4th - 2:00pm"Celebrity Gossip" Set Reminder
TV Showshowing on Channel1May 4th - 2:30pm Set Reminder

with the episodes not having data being shown as blank, episodes with titles shown as in "quotation marks" like above.

View 9 Replies View Related

Extract Data From Pdf & Enter Into Mysql Database?

Jan 29, 2010

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

View 4 Replies View Related

Separate Extract Data From A MySQL Database

Apr 4, 2007

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 View Related

Extra Backlashes - Extract Data From Mysql Table

Mar 28, 2007

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

trim(mysql_real_escape_string($value))

I am using the follow code to retrieve the data

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

View 2 Replies View Related

Extract Data From File Save Into Mysql Database?

Apr 20, 2011

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

View 2 Replies View Related

Extract All The Devices (and Their Attributes) Inside The TERA-WURFL Mysql Database?

May 4, 2011

Is there anyway I could extract all the devices (and their attributes) inside the TERA-WURFL mysql database with PHP? I need to show a list of supported devices in my web app.

There seems to be scant info on the internets on how to do this - can this be done?

View 1 Replies View Related

MySQL, Date Functions - Extract Queries Into A Human Readable Form?

Jan 24, 2011

Since I started programming in PHP.MySQL I have had a problem with date functions, this mostly due to a learning issue I have with numbers. I have never had any formal training and have had to rely on reading material that hasn't made a whole lot of sense to me. I have managed to get by, but probably do more work than is necessary.

Having said this, I am working on an invoice/appliance repair script which will have 3 dates in it, when the call came in, when it is scheduled to be fixed, and the completion date.

These dates may have to be searched on by a user using a web form. The user would enter something like 10/05/2011. There may also be MySQL queries on weeks, months, etc. Example, I need a query to find all the records from previous years.So what would be the best way to store these in MySQL and what should the field type be, and what would be the best way to extract these into a human readable form.

View 2 Replies View Related

Java - Extract Text From PDF : PDFLib Vs PDF Extract Vs Pdf2xml?

Sep 21, 2010

I am looking for a library (if possible available in Java or PHP) in order to extract text from a PDF. There is a lot of software available, including:

[code]....

Which tools would you choose? What do you think of them?

View 1 Replies View Related

Using Extract To Extract Post Dollar Variables?

Jun 27, 2010

im trying to build a foreach of sort of , that would extract($_POST) then utf8_decode each post so i dont have to do this manually for each $ variable, is it easy to make such function,

View 1 Replies View Related

PHP And Unicode

Jul 17, 2005

I'm building a website that will use Unicode data. Back-end using PHP and
SQL Server. The SQl Server database will store Unicode data (Chinese,
Japanese, etc.). PHP will be used to parse the data to the HTML web page.
Now, how does PHP deal with Unicode data? Is it any different than regular
English? Is there any high-level documentation on this subject?

View 1 Replies View Related

PHP & Unicode

Oct 24, 2005

I have a simple question on PHP and the way it handles strings.

Let's say I have a database and a php script that communicates with the
database. The database has some kind of character encoding - let's say
UTF-8, UTF-16, or something different.

When I select some string from the database, for example:

$res = mysql_query("SELECT movie_name FROM my_table");
$row = mysql_fetch_row($res);
echo $row[0];

the database will return the movie_name field in a correctly-encoded
way.

My question is, how do you tell the PHP interpreter what encoding to
use when displaying the text that the mysql queries return? In other
words, will the $row[0] be displayed correctly regardless the database
encoding, provided the database encoding and the HTML <meta> tags are
the same, or do I have to set the PHP encoding in some config file?
What character representation does PHP use when working with strings?

View 2 Replies View Related

PHP + Unicode

Aug 26, 2005

I have saved some data in a MySQL database as UTF-8 format. But when I
tried
to read the data using PHP, the webpage gave me all the "?"s. How to
read it
multilingual data correctly in PHP?


I believe there must be a way since I can see the words in UTF-8 in the

phpmyadmin interface. phpmyadmin is also coded in PHP and if it can do
it,
there must be a way to read multilingual data properly.

View 3 Replies View Related

Unicode/php

Jul 16, 2007

I have some javascript inside a $content .= ' ' var. When I use the braces { }in the javascript function, the view source displays as { and &#125. Do I need to change the page declaration. I'm running it as XHTML 1.0 strict, with a UTF-8 charset. Or am I going down the wrong road on that.

View 1 Replies View Related

Unicode

Feb 17, 2006

to convert a unicode text to normal text in a text box before using it. I have an aplication (SMS Application) that submits all the 160 character message to the database, then another script grabs it from the DB and sends it through the route. I'm having a problem with unicode characters, they cost double.

View 4 Replies View Related

Big5 To Unicode

Dec 5, 2003

I'm implementing a multi-language website using PHP and MySQL. I'm using the English WinXP Home with UltraEdit. I'm now looking for the tools which can change the words in big5/GB to Unicode. Would anyone give me some suggestions?

View 1 Replies View Related

Unicode Issues...

Feb 19, 2003

I was wondering if anyone could give me some suggestions to an issue that I am having. Basically, I have a simple form posting the field results to a database, and a method of editing the data that is being entered. So, I have a user typing out unicode lets use the trademark symbol (&#8482 -> .

The data is Posted to the form processing page and is entered into the database as the actual unicode (as it is typed out). The issue is that when the code is in edit mode, it exists in the page source as unicode (as it was typed into the form), but displays to the user as the symbol, which is also correct. The problem is that when I hit submit and Post the data to the processing page, the symbol is being Posted not the actual code for the symbol, which was originally typed into the input box and which existed in the source code of the edit input box's value.

Is there anyway to escape this, and on what end (the edit form display or the edit form's processing page)? I already played with the utf8_encode/decode fucntions with no results. I would also consider htmlentites(), but haven't tried as of yet.

View 1 Replies View Related

Escape To Unicode?

Jun 14, 2006

I've begun dealing with PHP's XML functions (puttup!)

I shoudl say- php's DEFAULT XML functions, no extensions. Probably not
5.0. I don't care...

The POINt is, they choke on funny characters, even encoded funny
characters. You need to use the unicode. (change &ntilde; to ).

Whatevuh.

That's why, why- now ignore that part, because it will distract and
proably cause you to misconstrue the thrust of the question to follow:

Does PHP have a function that will escape all funny characters in a
string (encoded, unencoded, both, either...) to their unicode
equivilants?

In a string- ignore the XML parts of this question.

(I'm looking at pre-proscessing the data coming into forms that will
form the offending XML)

View 2 Replies View Related

Query Using Unicode

Jul 17, 2005

I have set up a MySQL database (MySQL 4.1) which is encoded in UTF-8
with the utf8_general_ci collation. Inserted into the database is some
Japanese dictionary information.

Now I'd like to querie my database from within a PHP5 script. I have a
webform where the user inputs the Japanese data that needs to be queried
(webpage uses UTF-8 encoding). In my script I tell the database that I'm
sending unicode data: $db->query("SET NAMES 'utf8'");

Then I construct a query that looks like:

SELECT * FROM EDICT WHERE KANA=$term

The variable term contains the user inputted utf-8 data. However, this
query does not work. It gives zero results (and I've made sure that the
requested data is actually in the database).

The data in $term seems correct (it displays correctly when I echo the
variable).

View 4 Replies View Related

Unicode Email

Jun 21, 2005

I'm trying to send foreign language emails, and while the body of the email isn't being a problem the subject line is. It doesn't show properly in Outlook Express..

I just get a line of boxes or question marks. Does anyone know of a working object/function.. preferably that you've used and know works coz I've tried a few now and had no joy. Oh, and nothing from PEAR either coz it needs to stand alone.

View 5 Replies View Related

Readfile (UNICODE)

Jul 15, 2005

My PHP is configured in UTF-8 mode. Sometimes I need to display the contents of a file which is in UNICODE. I am trying to do this with readfile() but I just get garbage. How can I do this?

View 2 Replies View Related

Unicode Characters

Jul 19, 2005

On a site I'm currently working on, the "»" character is showing up as a question mark. I read up a little on mbstring on php.net, and I get the impression that unless I tell it to, php will not display any character whose unicode value is greater than 128 (in this case, » is 187). Am I barking up the wrong tree, or do I need to set one or more mbstring directives in php.ini?

View 2 Replies View Related

Convert To Unicode

Jun 27, 2005

I'm asking about method's to convert Text to Unicode Like This :

05656984554122563484644064A06430644645454...........

View 1 Replies View Related

Unicode Handling

Mar 4, 2006

I am trying to use "charset=utf-8" in my program, for handling 'hindi' language (indian).
The task is to accept inputs from users in 'hindi' language, store in DB and display in the same language as per search.

Is there any method to relate the english key-strokes with 'Hindi'?
e.g. how to type the equivalent word for [ 'universe' in english ] in 'Hindi'.

What precautions are to be taken through program, if the visitor browser does not support 'unicode' display format? Code:

View 2 Replies View Related

ADVERTISEMENT