id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
160	[PATCH] Save fails under wxMac	ChrisDolan		"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

...
#elif defined(__WXMAC__)
    // default is just empty string, this resolves to the default system                                                      
    // encoding later                                                                                                         
...

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()'
47

because it's making Mac-specific library calls.  Trying to map that code to a name does not help.

% wxPerl -le'use Wx; print Wx::FontMapper::GetEncodingName(Wx::Locale::GetSystemEncoding())'
unknown-47

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."	defect	closed	critical		editor	0.19	fixed		
