mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00

* Copied Tutorial from Google Code wiki. * Initial Home page * Copied How To Parse A Document from Google Code wiki * Updated How To Parse A Document (markdown) * Updated How To Parse A Document (markdown) * Updated How To Parse A Document (Old API) (markdown) * Copied How To Emit YAML from Google Code wiki * Copied Breaking Changes from Google Code wiki * Copied Strings from Google Code wiki * Updated Strings (markdown) * Updated Home (markdown) * Fix typo. * Updated Breaking Changes (markdown) * Updated How To Parse A Document (Old API) (markdown) * Updated Breaking Changes (markdown) * Move wiki content to docs/ * Improve markdown and add colored code syntax Co-authored-by: Jesse Beder <jbeder+github@gmail.com>
18 lines
952 B
Markdown
18 lines
952 B
Markdown
# Encodings and `yaml-cpp` #
|
|
|
|
`yaml-cpp` will parse any file as specificed by the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html#id2570322). Internally, it stores all strings in UTF-8, and representation is done with UTF-8. This means that in
|
|
|
|
```
|
|
std::string str;
|
|
node >> str;
|
|
```
|
|
|
|
`str` will be UTF-8. Similarly, if you're accessing a map by string key, you need to pass the key in UTF-8. If your application uses a different encoding, you need to convert to and from UTF-8 to work with `yaml-cpp`. (It's possible we'll add some small conversion functions, but for now it's restricted.)
|
|
|
|
---
|
|
|
|
For convenience, Richard Weeks has kindly provided a google gadget that converts Unicode to a string literal. It's a Google Gadget, so unfortunately it does not work on GitHub. Patches welcome to port it to a usable format here:
|
|
|
|
```
|
|
<wiki:gadget url="http://hosting.gmodules.com/ig/gadgets/file/111180078345548400783/c-style-utf8-encoder.xml"/>
|
|
``` |