{
"description": "String",
"bson_type": "0x02",
"test_key": "a",
"valid": [
{
"description": "Empty string",
"bson": "0D000000026100010000000000",
"extjson": "{\"a\" : \"\"}"
},
{
"description": "Single character",
"bson": "0E00000002610002000000620000",
"extjson": "{\"a\" : \"b\"}"
},
{
"description": "Multi-character",
"bson": "190000000261000D0000006162616261626162616261620000",
"extjson": "{\"a\" : \"abababababab\"}"
},
{
"description": "two-byte UTF-8 (\u00e9)",
"bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
"extjson": "{\"a\" : \"\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\"}"
},
{
"description": "three-byte UTF-8 (\u2606)",
"bson": "190000000261000D000000E29886E29886E29886E298860000",
"extjson": "{\"a\" : \"\\u2606\\u2606\\u2606\\u2606\"}"
},
{
"description": "Embedded nulls",
"bson": "190000000261000D0000006162006261620062616261620000",
"extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}"
}
],
"decodeErrors": [
{
"description": "bad string length: 0 (but no 0x00 either)",
"bson": "0C0000000261000000000000"
},
{
"description": "bad string length: -1",
"bson": "0C000000026100FFFFFFFF00"
},
{
"description": "bad string length: eats terminator",
"bson": "10000000026100050000006200620000"
},
{
"description": "bad string length: longer than rest of document",
"bson": "120000000200FFFFFF00666F6F6261720000"
},
{
"description": "string is not null-terminated",
"bson": "1000000002610004000000616263FF00"
},
{
"description": "empty string, but extra null",
"bson": "0E00000002610001000000000000"
},
{
"description": "invalid UTF-8",
"bson": "0E00000002610002000000E90000"
}
]
}