Updated wording intended to address concerns raised by Corentin and Hubert is below. Changes include:

The escaped string E representation of a string S is constructed by encoding a sequence of characters in the associated character encoding CE for charT ([lex.string.literal]) as follows:

When encoding a stateful character encoding, implementations should first initialize E to the initial encoding state. Each subsequent addition to E should begin with the final encoding state of the prior addition. E should be returned to the initial encoding state after the final quotation mark is appended.

Tom.

On 4/26/22 4:31 PM, Tom Honermann via SG16 wrote:

The proposed wording for [format.string.escaped]p4 in P2286R7: Formatting Ranges currently states:

The escaped character and escaped string representations of a character or string in a non-Unicode encoding is unspecified.
I would like this to be better specified to ensure implementations behave consistently.

The wording below is suggested as a replacement for [format.string.escaped]p2-p4 (link to p2) and is intended to cover both the Unicode and non-Unicode cases.

The escaped string E representation of a string S is constructed by encoding a sequence of characters in the associated character encoding CE for charT ([lex.string.literal]) as follows:

Please offer your thoughts, I would like to discuss this in tomorrow's SG16 meeting.

Tom.