<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nishiohirokazu</author_name>
  <author_url>https://blog.hatena.ne.jp/nishiohirokazu/</author_url>
  <blog_title>西尾泰和のはてなダイアリー</blog_title>
  <blog_url>https://nishiohirokazu.hatenadiary.org/</blog_url>
  <categories>
  </categories>
  <description>Java-ja温泉でちょうどエンコーディングの話で盛り上がっていたので@whosaysniに聞いてみた。print文でunicodeオブジェクトを出力しようとすると、出力先のシェルのエンコーディングでバイト列に変換してから出力される。 tmp$ cat &gt; tmp.py print u'\u307b\u3052' tmp$ python tmp.py ほげしかし、シェルの側でリダイレクトをしていると、シェルと違ってファイルのエンコーディングは簡単に取得できないので「エンコーディングわかんないから何で出したらいいかわかんないや。中身がasciiだったらそのまま出してもいいか」とasciiに変換し…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnishiohirokazu.hatenadiary.org%2Fentry%2F20100323%2F1269324128&quot; title=&quot;Pythonでprintの結果をリダイレクトする場合に出力のエンコーディングを指定する方法 - 西尾泰和のはてなダイアリー&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>2010-03-23 15:02:08</published>
  <title>Pythonでprintの結果をリダイレクトする場合に出力のエンコーディングを指定する方法</title>
  <type>rich</type>
  <url>https://nishiohirokazu.hatenadiary.org/entry/20100323/1269324128</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
