robert_gsfame Posted October 29, 2010 Share Posted October 29, 2010 are all languages possible to be inserted into database and be retrieved directly?? eg: write down the japanese words in the textbox and INSERT those into table and retrieve it using mysql_fetch_array() Is that as simple as that, or i have to modify certain script...for certain language? thx Link to comment https://forums.phpfreaks.com/topic/217167-language-question/ Share on other sites More sharing options...
btherl Posted October 29, 2010 Share Posted October 29, 2010 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 https://forums.phpfreaks.com/topic/217167-language-question/#findComment-1127838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.