On Wednesday, 11 June 2014 07:02:17 UTC-5, Ruby-Forum.com User wrote:
>
> I'm using Ruby 2.1.1 and Rails 4.1.1, with SQLite and, respectively,
> Postgres.
>
> All my strings are supposed to be UTF-8 encoded.
>
> Now, assuming I create a field in my model as
>
> data:string{20}
>
> can I safely assume, that this will store up to 20 characters, even if
> each character happens to be 3 bytes long in UTF-8 encoding?
>
>
>From the Postgres docs
(http://www.postgresql.org/docs/9.3/static/datatype-character.html):
"SQL defines two primary character types: character varying(n) and
character(n), where n is a positive integer. Both of these types can store
strings up to n characters (not bytes) in length."
So that sounds like yes. :)
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/1f738d77-8389-4dea-af67-141295f7f150%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.