Sha256: 9b1170e83af608f43606ac72f0bb6e78ce5ee2d98db5120e46d3a44052f642ec

Contents?: true

Size: 1.78 KB

Versions: 11

Compression:

Stored size: 1.78 KB

Contents

## Configuration Gotchas

The easiest way to work with Rails is to store all external data as UTF-8. If you don’t, Ruby libraries and Rails will often be able to convert your native data into UTF-8, but this doesn’t always work reliably, so you’re better off ensuring that all external data is UTF-8.

If you have made a mistake in this area, the most common symptom is a black diamond with a question mark inside appearing in the browser. Another common symptom is characters like “ü” appearing instead of “ü”. Rails takes a number of internal steps to mitigate common causes of these problems that can be automatically detected and corrected. However, if you have external data that is not stored as UTF-8, it can occasionally result in these kinds of issues that cannot be automatically detected by Rails and corrected.

Two very common sources of data that are not UTF-8:

* Your text editor: Most text editors (such as Textmate), default to saving files as UTF-8. If your text editor does not, this can result in special characters that you enter in your templates (such as é) to appear as a diamond with a question mark inside in the browser. This also applies to your I18N translation files. Most editors that do not already default to UTF-8 (such as some versions of Dreamweaver) offer a way to change the default to UTF-8. Do so.
* Your database. Rails defaults to converting data from your database into UTF-8 at the boundary. However, if your database is not using UTF-8 internally, it may not be able to store all characters that your users enter. For instance, if your database is using Latin-1 internally, and your user enters a Russian, Hebrew, or Japanese character, the data will be lost forever once it enters the database. If possible, use UTF-8 as the internal storage of your database.

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kitabu-1.0.6 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.5 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.4 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.3 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.2 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.1 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.0 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.0.rc4 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.0.rc3 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.0.rc2 examples/RailsGuides/text/13_Configuration_gotchas.mkdn
kitabu-1.0.0.rc1 examples/RailsGuides/text/13_Configuration_gotchas.mkdn