|
1 | 1 | <?xml version='1.0' encoding='utf-8' standalone='no'?> |
2 | 2 | <!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
3 | 3 |
|
4 | | -<issue num="4070" status="SG16"> |
| 4 | +<issue num="4070" status="Open"> |
5 | 5 | <title>Transcoding by <code>std::formatter<std::filesystem::path></code></title> |
6 | 6 | <section><sref ref="[fs.path.fmtr.funcs]"/></section> |
7 | 7 | <submitter>Jonathan Wakely</submitter> |
@@ -133,9 +133,7 @@ The minimal change is to replace "and not converting from `wchar_t` to UTF-8" wi |
133 | 133 | is not UTF-8". The optional change is to insert "ordinary" before "literal encoding" as well. Once that is done, |
134 | 134 | I'll have SG16 confirm they are content with the new proposed resolution. |
135 | 135 | </p> |
136 | | -</discussion> |
137 | | - |
138 | | -<resolution> |
| 136 | +<superseded> |
139 | 137 | <p> |
140 | 138 | This wording is relative to <paper num="N5008"/>. |
141 | 139 | </p> |
@@ -178,6 +176,95 @@ transcoding of a formatted `path` when `charT` and `path::value_type` differ |
178 | 176 | </li> |
179 | 177 |
|
180 | 178 | </ol> |
| 179 | +</superseded> |
| 180 | + |
| 181 | +<note>2025-07-30; SG16 meeting</note> |
| 182 | +<p> |
| 183 | +SG16 unanimously approved new wording produced during the discussion. |
| 184 | +The group concluded that the intended behavior would be best specified by |
| 185 | +introducing additional names to denote the sequence of transformations |
| 186 | +that produce the intended effect. Status → Open. |
| 187 | +</p> |
| 188 | + |
| 189 | +</discussion> |
| 190 | + |
| 191 | +<resolution> |
| 192 | +<p> |
| 193 | +This wording is relative to <paper num="N5014"/>. |
| 194 | +</p> |
| 195 | +<ol> |
| 196 | +<li><p>Modify <sref ref="[fs.path.fmtr.funcs]"/> as indicated:</p> |
| 197 | + |
| 198 | +<blockquote> |
| 199 | +<pre><code> |
| 200 | +template<class FormatContext> |
| 201 | + typename FormatContext::iterator |
| 202 | + format(const filesystem::path& p, FormatContext& ctx) const; |
| 203 | +</code></pre> |
| 204 | +<blockquote> |
| 205 | +<p> |
| 206 | +-5- |
| 207 | +<em>Effects</em>: |
| 208 | +Let `s` be |
| 209 | +<code>p.generic_string<del><filesystem::path::value_type></del>()</code> |
| 210 | +if the `g` option is used, otherwise `p.native()`. |
| 211 | +<ins>Let `s2` be `s` adjusted according to the <em>path-format-spec</em>. |
| 212 | +Let `s3` be defined as follows:</ins> |
| 213 | +<ol style="list-style-type: none"> |
| 214 | +<li> |
| 215 | +<ins> |
| 216 | +(5.1) — |
| 217 | +If `charT` is `char`, `path::value_type` is `wchar_t`, |
| 218 | +and the ordinary literal encoding is UTF-8, |
| 219 | +`s3` is the result of transcoding `s2` |
| 220 | +from the native encoding for wide character strings to UTF-8 |
| 221 | +with maximal subparts of ill-formed subsequences substituted |
| 222 | +with <span style="font-variant:small-caps">U+FFFD REPLACEMENT CHARACTER</span> |
| 223 | +per the Unicode Standard, Chapter 3.9 |
| 224 | +<span style="font-variant:small-caps">U+FFFD</span> Substitution in Conversion. |
| 225 | +</ins> |
| 226 | +</li> |
| 227 | +<li> |
| 228 | +<ins> |
| 229 | +(5.2) — |
| 230 | +If `charT` and `path::value_type` are the same, then `s3` is the same as `s2`. |
| 231 | +</ins> |
| 232 | +</li> |
| 233 | +<li> |
| 234 | +<ins> |
| 235 | +(5.3) — |
| 236 | +Otherwise, `s3` is the result of an implementation-defined transcoding of `s2`. |
| 237 | +</ins> |
| 238 | +</li> |
| 239 | +</ol> |
| 240 | +<ins>Writes <code>s3</code> into `ctx.out()`.</ins> |
| 241 | +<del> |
| 242 | +Writes `s` into `ctx.out()`, |
| 243 | +adjusted according to the <i>path-format-spec</i>. |
| 244 | +If `charT` is `char`, `path::value_type` is `wchar_t`, and the literal encoding |
| 245 | +is UTF-8, then the escaped path |
| 246 | +is transcoded from the native encoding for wide character strings to UTF-8 |
| 247 | +with maximal subparts of ill-formed subsequences substituted with |
| 248 | +<span style="font-variant:small-caps">u+fffd replacement character</span> per |
| 249 | +the Unicode Standard, Chapter 3.9 <span style="font-variant:small-caps">u+fffd</span> |
| 250 | +Substitution in Conversion. |
| 251 | +If `charT` and `path::value_type` are the same then no transcoding is performed. |
| 252 | +Otherwise, transcoding is implementation-defined. |
| 253 | +</del> |
| 254 | +</p> |
| 255 | +</blockquote> |
| 256 | +</blockquote> |
| 257 | +</li> |
| 258 | + |
| 259 | +<li> |
| 260 | +Modify the entry in the index of implementation-defined behavior as indicated: |
| 261 | +<blockquote> |
| 262 | +transcoding of a formatted `path` when `charT` and `path::value_type` differ |
| 263 | +<ins>and the ordinary literal encoding is not UTF-8</ins> |
| 264 | +</blockquote> |
| 265 | +</li> |
| 266 | +</ol> |
| 267 | + |
181 | 268 | </resolution> |
182 | 269 |
|
183 | 270 | </issue> |
0 commit comments