Skip to content

Commit

Permalink
Added something about UTF-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
KittyGiraudel committed Feb 16, 2015
1 parent 4cc7551 commit 6a6abd5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions en/_syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ We will not tackle the question of file organization in this section. It is the

## Strings

Believe it or not, strings play quite a large role in both CSS and Sass ecosystems. Most CSS values are either lengths or strings (usually unquoted), so it actually is quite crucial to stick to some guidelines when dealing with strings in Sass.

### Encoding

To avoid any potential issue with character encoding, it is highly recommended to force [UTF-8](http://en.wikipedia.org/wiki/UTF-8) encoding in the [main stylesheet](#main-file) using the `@charset` directive. Make sure it is the very first element of the stylesheet and there is no character of any kind before it.

<div class="code-block">
<div class="code-block__wrapper" data-syntax="scss">
{% highlight scss %}
@charset 'utf-8';
{% endhighlight %}
</div>
<div class="code-block__wrapper" data-syntax="sass">
{% highlight sass %}
@charset 'utf-8'
{% endhighlight %}
</div>
</div>

### Quotes

CSS does not require strings to be quoted, not even those containing spaces. Take font-family names for instance: it doesn't matter whether you wrap them in quotes for the CSS parser.

Because of this, Sass *also* does not require strings to be quoted. Even better (and *luckily*, you'll concede), a quoted string is strictly equivalent to its unquoted twin (e.g. `'abc'` is strictly equal to `abc`).
Expand Down
2 changes: 2 additions & 0 deletions en/_toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* [Key Principles](#key-principles)
* [Syntax & Formatting](#syntax-&-formatting)
* [Strings](#strings)
* [Encoding](#encoding)
* [Quotes](#quotes)
* [Strings as CSS values](#strings-as-css-values)
* [Strings containing quotes](#strings-containing-quotes)
* [URLs](#urls)
Expand Down

0 comments on commit 6a6abd5

Please sign in to comment.