[PATCH] Save fails under wxMac
|Reported by:||ChrisDolan||Owned by:|
Save fails with "Could not save: Invalid argument" and writes a zero-length file. Save as... fails too. Save on close fails too, and closes the document anyway, losing all changes.
I get this warning at the same time:
Use of uninitialized value in concatenation (.) or string at /Users/chris/Work/Padre/blib/lib/Padre/Document.pm line 377.
Cannot find encoding "" at /Users/chris/Work/Padre/blib/lib/Padre/Document.pm line 377.
Here's a diagnostic test:
% wxPerl -le'use Wx; print "\"" . Wx::Locale::GetSystemEncodingName?() . "\""'
Padre svn r1449, Mac 10.4, perl 5.8.6, Wx 0.88, wxwindows 2.8.8
I looked in the wxWidgets 2.8.8 source code and found the following in GetSystemEncodingName?() in src/common/intl.cpp
default is just empty string, this resolves to the default system
so it appears that the empty string is the norm for the encoding name. On the other hand, GetSystemEncoding?() yields
% wxPerl -le'use Wx; print Wx::Locale::GetSystemEncoding?()'
because it's making Mac-specific library calls. Trying to map that code to a name does not help.
In my environment, I have LC_ALL=C and I do not have LANG set.
One solution would be an editor global fallback encoding, probably defaulting to the system encoding, if any, or utf-8 otherwise.