<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Takachan</author_name>
  <author_url>https://blog.hatena.ne.jp/Takachan/</author_url>
  <blog_title>PG日誌</blog_title>
  <blog_url>https://takap-tech.com/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>C++でstd::stringに日本語が設定されているときに、size(), length()メソッドで文字列長を取得しようとすると日本語の長さが取得できません。中身がマルチバイト可変長 + 特殊ルールという構造になっているようで、1文字が1バイト～6バイトとなっているため中身のバイト数が帰ってきているようです。 なので文字列長の取得方法は、ここに記載されている内容と仕様そのものを理解して自分で実装するか、Google検索で&quot;c++ string 日本語 長さ“とか、3rd製のライブラリを利用するなどなど、あると思いますが、どれも割と労力を要するので、こちらを参考に、日本語が入ってるstrin…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakap-tech.com%2Fentry%2F2017%2F09%2F04%2F034556&quot; title=&quot;std::stringの日本語の長さを取得する - PG日誌&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>https://cdn-ak.f.st-hatena.com/images/fotolife/T/Takachan/20170728/20170728135056.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-09-04 03:45:56</published>
  <title>std::stringの日本語の長さを取得する</title>
  <type>rich</type>
  <url>https://takap-tech.com/entry/2017/09/04/034556</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
