<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sebastes</author_name>
  <author_url>https://blog.hatena.ne.jp/sebastes/</author_url>
  <blog_title>水清無魚（すいせいむぎょ）</blog_title>
  <blog_url>https://sebastes.hatenadiary.org/</blog_url>
  <categories>
    <anon>知</anon>
  </categories>
  <description>恥ずかしながら、Rubyで以下のようにファイルに出力する時に、文字化けするって悩んでしまった。 open('xxx.csv', 'w') do |f| datas.each do |data| f.puts NKF.nkf('-W -s', data) end end Javaなどと同様に、ファイルの出力エンコードを指定してやらないと行けないのにね。 open('xxx.csv', 'w:cp932') do |f| datas.each do |data| f.puts data end end 参照：Rubyのエンコーディング - @tmtms のメモそれと、これもいまさらなんだけど、「ソ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsebastes.hatenadiary.org%2Fentry%2F20130620%2F1371681135&quot; title=&quot;Rubyでファイルに出力する時のエンコーディング - 水清無魚（すいせいむぎょ）&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2013-06-20 07:32:15</published>
  <title>Rubyでファイルに出力する時のエンコーディング</title>
  <type>rich</type>
  <url>https://sebastes.hatenadiary.org/entry/20130620/1371681135</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
