LoginSignup
3
3

More than 5 years have passed since last update.

Sinatraでhaml中にmarkdownテンプレートを使う時の注意点

Posted at

markdownに日本語が含まれる場合、そのままだとEncoding::CompatibilityErrorが出てしまう。
文字コードが違うからみたい。
なので解決方法としてとりあえず、

= markdown(:filename).force_encoding("utf-8")

とするとエラーは回避できる。ただこれを毎回書くのは冗長になるのでもっといい方法ないか要検討。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3