473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Foreign languages and PHP

Hi...

I'm trying to load in a text file using fgets into a database table.
The text file contains a dictionary of terms in the form:

<englishword>\t<spanishword>

Problem is that the spanish words contain characters that are spanish
specific, and when I read them in, they are converted into '?'.

I don't want this.
Any suggestions as to how to get around this?

TIA,
Joe

Oct 10 '06 #1
2 1183

"JoeT" <tr*****@yahoo.com???????/???????? ? ???????? ?????????:
news:11**********************@k70g2000cwa.googlegr oups.com...
Hi...

I'm trying to load in a text file using fgets into a database table.
The text file contains a dictionary of terms in the form:

<englishword>\t<spanishword>

Problem is that the spanish words contain characters that are spanish
specific, and when I read them in, they are converted into '?'.

I don't want this.
Any suggestions as to how to get around this?

TIA,
Joe
what version of mysql you have?
try default charset to utf8.
Oct 10 '06 #2
JoeT wrote:
Problem is that the spanish words contain characters that are spanish
specific, and when I read them in, they are converted into '?'.

I don't want this.
Any suggestions as to how to get around this?
Use the same character set for input and output.
If you got them as iso-8859-1 output them as iso-8859-1 (or convert)
If you got them as utf-8 output utf-8 (or convert)

<?php
$charsets = array('iso-8859', 'utf-8', 'us-ascii', 'iso-2022-jp', 'koi8-r');
$charset = $charsets[array_rand($charsets)];

header('Content-Type: text/plain; charset=' . $charset);

echo "Example of $charset\n\n\n";
for ($i=0; $i<16; ++$i) {
echo dechex($i), " :: ";
for ($j=0; $j<16; ++$j) {
echo chr($i*16 + $j);
}
echo "\n";
}
?>
Q: Why does my browser want to download this script when $charset is
"iso-8859-1"? (That is why I reverted to "iso-8859" in the script).

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Smash | last post by:
i have this function: ------------------------------------------------------------ function isAlfaNumeric(vnos,space) { if (space==false) { validRegExp = /^{0,}$/; } else { validRegExp =...
43
by: David Trimboli | last post by:
In a text, I might want to include a foreign language term. In print, this is typically shown with italics. For instance (asterisks represent italics): 'I thought it was only a kind of *cram,*...
47
by: Andy Dingley | last post by:
Assume an English language page, linking to a foreign history resource that's only available in a foreign language. Any suggestions on appropriate "best practice" markup, particularly regarding the...
13
by: Xah Lee | last post by:
the Journey of Foreign Characters thru Internet Xah Lee, 20051101 There's a bunch of confusions about the display of non-ascii characters such as the bullet "•". These confusions are...
1
by: Dave | last post by:
Hi All, I have a VS.NET 2003 solution that uses several setup projects to package various components and applications into MSI files. I need to provide foreign language support for 5-6 languages...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
6
by: Victor Spång Arthursson | last post by:
New to foreign keys and have some questions… The first is, i have a language table with a primary key on the fields lang and relid: relid | lang | text -------+------+------------- 11111...
9
by: Bock | last post by:
I was just told about Python. My searching and reading over the net I was able to learn that Python can handle "foreign" characters via Unicodes. Can or does Python write unicode to the...
16
by: Hugh Janus | last post by:
Hi all, I posted a couple of weeks ago with what I thought was a problem with the file system reading accented characters however, after debugging line by line I have now found the true problem....
3
by: UJ | last post by:
How do folks handle foreign languages? For instance - we would like to be able to have a screen at the front of our app that will allow somebody to choose French and then the entire site is in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.