Jump to content

Language question


robert_gsfame

Recommended Posts

It's not as simple as that.. there are languages, there are characters, and there are character encodings.  Languages are written in characters, but you can't store a character into a database directly, it has to be in some kind of encoding.  Usually databases will be using Latin 1, ISO-8859-1 or UTF8 as the default encoding.

 

But as long as you are consistent with encodings, then yes, you can just take the data from the textbox, insert it into the table (using mysql_escape_string()) and then fetch it back again.  The simplest way is cheating a bit, but if you leave your database encoding as a basic one like ISO-8859-1 (likely to be the default), then you can insert ANY encoding into it and fetch it back without problems.  On the other hand, if your database is UTF8 then it will reject anything that's not UTF8, and you might find other, more common japanese encoding like SJIS or EUC-JP get rejected, unless you first convert them to UTF8.

 

So the simple way - database encoding as ISO-8859-1 or Latin 1, insert your data with escaping, fetch it back and put it back into your HTML.  Ideally your HTML and/or your content headers should indicate what encoding you're using as well.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.