chayyoo has asked for the wisdom of the Perl Monks concerning the following question:
I am trying my first steps in C using Inline::C. I have written a couple of string handling functions that work quite well. They work on UTF-8 strings. What really bothers me is the required transcoding when passing the strings in and out of Perl, e.g.
$perl_string = decode("utf8", my_c_function(encode("utf8",$_)));
Is there an elegant way around this encode/decode thing? (running Perl 5.10.1)
I understand that Perl's internal coding is UTF-8, but that it automatically transcodes to Latin-1 on in- and output, which causes my grief. Is the Perl interpreter smart enough to bypass these en-/decodings when it encounters the line above? I should hope so.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bypass utf-8 encoding/decoding?
by ikegami (Patriarch) on Nov 30, 2017 at 20:21 UTC | |
by karlgoethebier (Abbot) on Dec 01, 2017 at 08:48 UTC | |
by choroba (Cardinal) on Dec 01, 2017 at 10:04 UTC | |
by 1nickt (Canon) on Dec 01, 2017 at 13:23 UTC | |
by 1nickt (Canon) on Dec 01, 2017 at 14:01 UTC | |
| |
by karlgoethebier (Abbot) on Dec 01, 2017 at 10:09 UTC | |
by ikegami (Patriarch) on Dec 01, 2017 at 16:23 UTC | |
by karlgoethebier (Abbot) on Dec 01, 2017 at 16:51 UTC | |
| |
|
Re: Bypass utf-8 encoding/decoding?
by Laurent_R (Canon) on Nov 30, 2017 at 16:31 UTC | |
|
Re: Bypass utf-8 encoding/decoding?
by karlgoethebier (Abbot) on Nov 30, 2017 at 19:06 UTC | |
|
Re: Bypass utf-8 encoding/decoding?
by Anonymous Monk on Nov 30, 2017 at 16:24 UTC | |
by chayyoo (Novice) on Nov 30, 2017 at 19:05 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |