|
|
Problem with adding a new record into MySQL DB
MySQL DB's character-set is UTF8 and RoR(Ruby on Rails)'s database.yml
has a line 'encoding: utf8'.
If I add a new record using RoR's new action via Web Browser, Korean is
stored without problem.
If I set fiels explicitly like 'MyActionRecord['fieldname'] =3D '<some
Korean letters>', and invoke save method... yes, it works, but Korean
is not saved correctly. English was okay with same code.
How can I convert Korean letters to UTF8 characters? I did many tries
and finally I'm here.
irb(main):001:0> "=ED=95=9C=EA=B8=80" <-- I can't sure you guys can see =
this
letter. They are just two Korean letters.
=3D> "\307\321\261\333" <--- What the hell.....T^T
irb(main):002:0> "aaa" <--- English, of course.
=3D> "aaa" <--- No problem. - -
Please help...
|
|
0
|
|
|
|
Reply
|
hongseok.yoon (19)
|
7/12/2006 4:45:31 AM |
|
On 7/12/06, hongseok.yoon@gmail.com <hongseok.yoon@gmail.com> wrote:
> MySQL DB's character-set is UTF8 and RoR(Ruby on Rails)'s database.yml
> has a line 'encoding: utf8'.
> If I add a new record using RoR's new action via Web Browser, Korean is
> stored without problem.
> If I set fiels explicitly like 'MyActionRecord['fieldname'] = '<some
> Korean letters>', and invoke save method... yes, it works, but Korean
> is not saved correctly. English was okay with same code.
Firstly you want the rails list at
http://lists.rubyonrails.org/mailman/listinfo/rails
Secondly chances are you're not sending your web pages with the
content-type set correctly. Use something like LiveHTTPHeaders for
Firefox (don't have a URL I'm sorry) and see if you get a line like
this:
Content-Type: text/html; charset=utf8
you're sending UTF8 encoded pages, if not then you need to send it.
I'm not sure on how to do this in Rails, see the Rails list.
--
Phillip Hutchings
http://www.sitharus.com/
|
|
0
|
|
|
|
Reply
|
sitharus (23)
|
7/12/2006 5:37:42 AM
|
|
On Jul 12, 2006, at 12:50 AM, hongseok.yoon@gmail.com wrote:
> MySQL DB's character-set is UTF8 and RoR(Ruby on Rails)'s database.yml
> has a line 'encoding: utf8'.
> If I add a new record using RoR's new action via Web Browser, =20
> Korean is
> stored without problem.
> If I set fiels explicitly like 'MyActionRecord['fieldname'] =3D '<some
> Korean letters>', and invoke save method... yes, it works, but Korean
> is not saved correctly. English was okay with same code.
>
> How can I convert Korean letters to UTF8 characters? I did many tries
> and finally I'm here.
>
> irb(main):001:0> "=ED=95=9C=EA=B8=80" <-- I can't sure you guys can =
see this
> letter. They are just two Korean letters.
> =3D> "\307\321\261\333" <--- What the hell.....T^T
> irb(main):002:0> "aaa" <--- English, of course.
> =3D> "aaa" <--- No problem. - -
>
> Please help...
I can see it. :)
Secondly, the output from irb is the #inspect string. Try doing
puts "=ED=95=9C=EA=B8=80"
and see if that gives you what you expect. (Works good for me)
|
|
0
|
|
|
|
Reply
|
logancapaldo (886)
|
7/15/2006 4:00:48 AM
|
|
|
2 Replies
22 Views
(page loaded in 0.056 seconds)
Similiar Articles: phpmyadmin with NOW() timestamp field - comp.databases.mysql ...I have a MySQL database ... Insert into"... inserted in phpmyadmin is ... in your code: echo "I'm inserting a new record now ... nom) values > ('test','essai')",$link); add ... Efficient way to delete a large amount of records from a big table ...... large table (~500K records) in my MySql DB ... operations that are adding or working on new records. 500K records isn't a large database. ... I recall having a problem ... Ordering on Hierarchical Dot Notation - comp.lang.java.programmer ...I have a SQL database (MySql) containing a ... but involves delving deep into MySql's operation. Also, it's not portable across db's. ... auxillary column, and when adding records ... Sharepoint linked table - can add records but can't update ...... have an Access 2003 database linked to a simple list (one field) in Sharepoint 2007. When I open the table in Access, I can add new records... ... comp.databases.mysql ... ... How to optimize primary key change on a large table? - comp ...... only need to rename the old DB files (add a _ to the end or something, so MySQL won't load them).. then move the new DB tables into ... Slow Commit New Record - Looking for ... RDDSQL - where to find an example - comp.lang.xharbour... example about using RDDSQL and MySQL database ... Luiz I'm able to connect to database. As I've tested, the problem ... by Marek Olszewski for testing Record Locking with MySQL ... Insert statements and foreign keys etc.. - comp.databases.mysql ...I want to insert into this database. My record comes ... If I always use my *NEW* ebay ... etc.. - comp.databases.mysql ... I want to insert into this database. My record ... How best to detect duplicate values in a column? - comp.databases ...... than thirty different questions, I'll add a new ... utility, to show me where I have a problem of more than one record ... require a stored procedure inside MySQL database so ... retrieve most recent record for each user - comp.databases.mysql ...... all 18k status records then dumping them into an ... retrieve most recent record for each user - comp.databases.mysql ... ... select most recent records for each computer ... New ... remove any commas/data from mysql? - comp.databases.mysql ...... row)."\n"; > } > > The problem is that ... large table (~500K records) in my MySql DB ... to allow to import all the data into another sql-database. For MySQL ... MySQL :: problem using mysql_query to do MySQL SELECT after add ...MySQL Forums:: PHP:: problem using mysql_query to do MySQL SELECT after add new record into database table PHP Tutorials: Adding records to a MySQL databaseAdding Records to a MySQL Database with PHP . To add ... have a look at the new, and rather long, statement. INSERT INTO … VALUES. To add records to your database, you ... 7/22/2012 3:44:01 AM
|
|
|
|
|
|
|
|
|