How do i make rails not use utf8

I want ror to not use utf8. I have tried setting $KCODE to ‘n’.
Activercord still tries to convert my special characters to utf.

The character ‘ê’ comes as "\303\252’. I want it to show the ê WITHOUT
using utf8. I have NO reason to use utf8. I do not know if this is a
rails or ruby issue. Can someone please help?

Ruby: 1.8.7
Rails: 2.3.8
Database: Firebird 2.1.3

On Sep 24, 9:21 am, john [email protected] wrote:

I want ror to not use utf8. I have tried setting $KCODE to ‘n’.
Activercord still tries to convert my special characters to utf.

The character ‘ê’ comes as "\303\252’. I want it to show the ê WITHOUT
using utf8. I have NO reason to use utf8. I do not know if this is a
rails or ruby issue. Can someone please help?

I’d strongly recommend you reconsider that position - you’ve got to
use some encoding to encode your text, what encoding do you want to
use that is ‘better’ than utf-8 ?

There are multiple pieces to the problem:

  • response to the user’s browser need to state the correct character
    set (ActionController::Base.default_charset controls the default
    character set user)
  • your database should be set to use correct collation etc (eg a utf8
    string is not sorted in the same way as a latin1 string, some
    sequences of bytes are not valid utf8 etc)
  • your data needs to actually be in that encoding: if you have
    existing content you will have to convert it all to this new encoding
    (and depending on your content there might not be a single encoding
    that covers all of them).
  • browser shenanigans

To my knowledge, active record itself doesn’t do any conversion
(beyond in some cases telling the adapter library what character set
it expects) - you’re probably seeing the browser encode what you type
as utf-8

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs