File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -197,18 +197,10 @@ sub to_toml_key {
197
197
198
198
if ($str =~ / ^$BareKey $ / ) {
199
199
return $str ;
200
- }
201
-
202
- # Escape control characters
203
- $str =~ s / ([\p {General_Category=Control}])/ '\\ u00' . unpack('H2', $1 )/ eg ;
204
-
205
- # Escape unicode characters
206
- # $str =~ s/($NonASCII)/'\\u00' . unpack('H2', $1)/eg;
207
-
208
- if ($str =~ / ^"/ ) {
209
- return qq{ '$str '} ;
210
200
} else {
211
- return qq{ "$str "} ;
201
+ # Not valid as a "bare key". Encode it as a "quoted key"
202
+ # (in TOML terminology), using the "literal string" format.
203
+ return to_toml_string($str );
212
204
}
213
205
}
214
206
Original file line number Diff line number Diff line change @@ -144,6 +144,15 @@ hosts = [
144
144
"omega"
145
145
]
146
146
147
+ [cfg."something with a 'single-quote'".nested]
148
+ inner = "forty-one"
149
+
150
+ [cfg.'something with a "double-quote"'.nested]
151
+ inner = "forty-two"
152
+
153
+ [cfg."something with a 'single-quote' and a \"double-quote\"".nested]
154
+ inner = "forty-three"
155
+
147
156
[[products]]
148
157
name = "Hammer"
149
158
sku = 738594937
You can’t perform that action at this time.
0 commit comments