Hi,
On 30/04/2013 15:38, Johan Vromans wrote:
2. This data is the current default format fro wxWidgets.
Which I understand it may work if you're lucky.
I am of the opinion that this bit ( WXSTRING_INPUT ) already works as
well as it can do if given an SV and no other params. I certainly
would not want to change it to force all input to be valid UTF-8.
There is absolutely no reason to do so.
Forcing valid UTF-8 will enhance both cases to "will allways work". This
sounds like a good reason to me.
Only if the input actually is valid UTF-8. Something only the Perl coder
can know / ensure. It isn't a requirement of the wxWidgets library.
[ ... on upgrade ... ]
I don't think there's a coding error just because I use
utf8::upgrade($string). I don't need utf8::upgrade for my Perl code. I
need it to allow me to tell wxWidgets what's in $string.
I understand this to mean: always do a utf::upgrade *before* passing a
string to wxWidgets. For me this is a signal that upgrading should take
place on the Perl <-> wxWidgets boundary and not in the user program.
No, it means do a utf::upgrade before passing a string that you know
contains valid UTF-8 to ensure the scalar is marked as such.
I appreciate your view may be different and you're entitled to think
mine is wrong.
My knowledge of the hairy details of Perl and Unicode is not sufficient
to tell what/who is wrong or right. Hence my urge to understand.
I don't believe there is an actual wrong or right. I know that forcing
the input to be marked as utf8 at the Perl <=> wxWidgets boundary will
break any existing code that passes buffers that aren't valid UTF-8. It
makes assumptions about the data buffer passed that are not universally
true.
I think you are getting focused on the concept that 'decode' alone is
enough and everything else should just work. I don't see this as the
issue at all. I don't really care about the internals of decode and
Perl's unicode handling. It doesn't matter here.
I am simply saying that one can achieve consistent results when calling
wxWidgets methods if one is explicit about the data format of the data
buffers passed.
If there is a buffer known to contain valid UTF-8, then a simple
shortcut is utf8::upgrade($string);
If I read your proposal correctly, you want to demand that all data
buffers that may get passed to the wxString conversion function are
valid UTF-8?
Hope I'm not missing the point.
Regards
Mark