develooper Front page | perl.perl5.porters | Postings from September 2017

Re: [perl #131683] Encode::ONLY_PRAGMA_WARNINGS in$PerlIO::encoding::fallback

Thread Previous | Thread Next
From:
Karl Williamson
Date:
September 12, 2017 01:24
Subject:
Re: [perl #131683] Encode::ONLY_PRAGMA_WARNINGS in$PerlIO::encoding::fallback
Message ID:
09341ce0-7ac9-5478-6bb8-f0a50b52e8e3@khwilliamson.com
On 09/11/2017 06:13 PM, Tony Cook via RT wrote:
> One problem with implementing this as XS is the same problem as the goto solution - the call to utf8n_to_uvuni() would only produce warnings if the current context has utf8 warnings enabled, regardless of ONLY_PRAGMA_WARNINGS.

Note that there is a new API in 5.26 which allows you to get a bit field 
returned with a bit set for every error encountered in the input character.

As it says in the docs:

To do your own error handling, call this function with the 
C<UTF8_CHECK_ONLY>
flag to suppress any warnings, and then examine the C<*errors> return.

	UV	utf8n_to_uvchr_error(const U8 *s, STRLEN curlen,
		                     STRLEN *retlen,
		                     const U32 flags,
		                     U32 * errors)


If we get Devel::PPPort maintained, I had hoped to put it there.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About