C++ Logo

sg16

Advanced search

Re: [isocpp-sg16] Use cases for user construction of text_encoding by name

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 22 Jul 2024 17:41:47 -0700
On Monday 22 July 2024 13:58:08 GMT-7 Henri Sivonen via SG16 wrote:
> As for having an API for querying the IANA identity of the execution
> encoding, how does that benefit interop?

That's a good question. What is the use-case of this function anyway?

If you want to interoperate and you don't know what the other side's encoding
is, you should use one of the UTF encodings. That also maximises your own
functionality, in case the encoding you're trying to use cannot support some
characters that you would like to send or receive.

Maybe one use-case is to transmit a text file verbatim to another entity,
without translating it locally first. For example, it might be digitally signed
and the other side may want to verify its intact reception. But the execution
encoding here is a mere hint, because the file in question need not be encoded
in the execution's charset or even be a text file in the first place. This in
fact is the use-case of the web server, and WHATWG has more experience in this
matter.

The one use I have of nl_langinfo(CODESET) is to print a warning when it does
not return "UTF-8".

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-07-23 00:41:49