Hi all, I want to build a Japanese website by RoR. Does RoR support Shift-JIS encoding? Or does it have plug-in support Shift-JIS encoding? Thanks, For Ad Now --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Although the Rails-Core list is meant for discussion on development of the framework, I would like to reply because the answer is probably not widely known. Rails currently defaults to UTF-8 everywhere. You can, in theory, use Shift-JIS and any other encoding if you like but don''t expect it to be easy. You will have to: 1. Make sure your database and data is Shift-JIS 2. Make sure the connection to the database is Shift-JIS (using database.yml and the encoding configuration option) 3. Make sure all Rails internal string handling is Shift-JIS, by writing your own Chars handler (See UTF8Handler), or don''t use any text helpers etc. 4. Override the default encoding set in the content-type sent by Rails 5. Set the encoding specifically in your HTML If you don''t have any special reason to use Shift-JIS for your project, it''s probably easier to just use UTF-8. If you have any further questions don''t hesitate to contact me personally. Manfred On May 15, 2008, at 6:15 AM, For Ad wrote:> I want to build a Japanese website by RoR. > Does RoR support Shift-JIS encoding? > > Or does it have plug-in support Shift-JIS encoding?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you very much! On May 15, 2:18 pm, Manfred Stienstra <manf...@gmail.com> wrote:> Although the Rails-Core list is meant for discussion on development of > the framework, I would like to reply because the answer is probably > not widely known. > > Rails currently defaults to UTF-8 everywhere. You can, in theory, use > Shift-JIS and any other encoding if you like but don''t expect it to be > easy. You will have to: > > 1. Make sure your database and data is Shift-JIS > 2. Make sure the connection to the database is Shift-JIS (using > database.yml and the encoding configuration option) > 3. Make sure all Rails internal string handling is Shift-JIS, by > writing your own Chars handler (See UTF8Handler), or don''t use any > text helpers etc. > 4. Override the default encoding set in the content-type sent by Rails > 5. Set the encoding specifically in your HTML > > If you don''t have any special reason to use Shift-JIS for your > project, it''s probably easier to just use UTF-8. If you have any > further questions don''t hesitate to contact me personally. > > Manfred > > On May 15, 2008, at 6:15 AM, For Ad wrote: > > > I want to build a Japanese website by RoR. > > Does RoR support Shift-JIS encoding? > > > Or does it have plug-in support Shift-JIS encoding?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
A while ago I was messing with ShiftJIS and found some pretty helpful methods in the RSS::Converter library (in the ruby core lib), such as def_to_utf_8_from_shift_jis() or def_to_utf_8_from_shift_jis(). It does seem a little random using an RSS library if you''re not doing RSS stuff, but it worked pretty well for me. The only drawback - from what I understand (correct me if I''m wrong) - is that there are different interpretations of Shift JIS, so the input that you get might not exactly be compatible with your interpreter, -tieg On May 15, 3:39 am, For Ad Now <forad...@gmail.com> wrote:> Thank you very much! > > On May 15, 2:18 pm, Manfred Stienstra <manf...@gmail.com> wrote: > > > Although the Rails-Core list is meant for discussion on development of > > the framework, I would like to reply because the answer is probably > > not widely known. > > > Rails currently defaults to UTF-8 everywhere. You can, in theory, use > > Shift-JIS and any other encoding if you like but don''t expect it to be > > easy. You will have to: > > > 1. Make sure your database and data is Shift-JIS > > 2. Make sure the connection to the database is Shift-JIS (using > > database.yml and the encoding configuration option) > > 3. Make sure all Rails internal string handling is Shift-JIS, by > > writing your own Chars handler (See UTF8Handler), or don''t use any > > text helpers etc. > > 4. Override the default encoding set in the content-type sent by Rails > > 5. Set the encoding specifically in your HTML > > > If you don''t have any special reason to use Shift-JIS for your > > project, it''s probably easier to just use UTF-8. If you have any > > further questions don''t hesitate to contact me personally. > > > Manfred > > > On May 15, 2008, at 6:15 AM, For Ad wrote: > > > > I want to build a Japanese website by RoR. > > > Does RoR support Shift-JIS encoding? > > > > Or does it have plug-in support Shift-JIS encoding?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On May 15, 1:15 pm, "For Ad" <forad...@gmail.com> wrote:> I want to build a Japanese website by RoR. > Does RoR support Shift-JIS encoding? > > Or does it have plug-in support Shift-JIS encoding?jpmobile plugin can translate UTF-8 to SJIS using filters in controller. You can write your code by UTF-8 and store users'' data by UTF-8. http://rubyforge.org/projects/jpmobile/ Although this plugin aims to build websites for mobile phones in Japan, you will find the way to use Shift-JIS in your application. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---