From: Phil Sutter <phil@nwl.cc>
To: Eric Garver <eric@garver.life>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] py: fix missing decode/encode of strings
Date: Fri, 3 May 2019 17:51:54 +0200 [thread overview]
Message-ID: <20190503155154.GM31599@orbyte.nwl.cc> (raw)
In-Reply-To: <20190501163500.29662-1-eric@garver.life>
Hi,
On Wed, May 01, 2019 at 12:35:00PM -0400, Eric Garver wrote:
> When calling ffi functions we need to convert from python strings to
> utf-8. Then convert back for any output we receive.
So the problem is passing utf-8 encoded strings as command?
[...]
> - rc = self.nft_run_cmd_from_buffer(self.__ctx, cmdline)
> - output = self.nft_ctx_get_output_buffer(self.__ctx)
> - error = self.nft_ctx_get_error_buffer(self.__ctx)
> + rc = self.nft_run_cmd_from_buffer(self.__ctx, cmdline.encode("utf-8"))
> + output = self.nft_ctx_get_output_buffer(self.__ctx).decode("utf-8")
> + error = self.nft_ctx_get_error_buffer(self.__ctx).decode("utf-8")
Should the encoding be made configurable? I see encode() and decode()
parameters are optional, but as soon as I call them with a string
containing umlauts I get errors. So not sure if that would be an
alternative.
BTW, thanks for all these fixes!
Cheers, Phil
next prev parent reply other threads:[~2019-05-03 15:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 16:35 [PATCH nft] py: fix missing decode/encode of strings Eric Garver
2019-05-03 15:51 ` Phil Sutter [this message]
2019-05-03 17:20 ` Eric Garver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190503155154.GM31599@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=eric@garver.life \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).