Opened 11 years ago

Last modified 8 years ago

#191 assigned defect

could not find encoding on OS X 10.5, fails tests

Reported by: leedo Owned by: tome, bennie
Priority: major Milestone:
Component: editor Version: 0.50
Keywords: osx Cc: stennie@…


I tried building the latest version of Padre (0.22) on OS X 10.5. After getting all the dependencies installed I got this rather long test error:

I went ahead and force installed, which got me a new window, but the editor area was missing. I was also unable to successfully open any perl files. I received a similar "could not find system(darwin) default encoding" message in the status bar when I tried.

Here is the relevant version info:
Wx Version: 0.89 wxWidgets 2.8.9
This is perl, v5.10.0 built for darwin-thread-multi-2level

Change History (10)

comment:1 Changed 11 years ago by leedo

Here is my locale output, which I think was asked for in the following error message. If something else is needed, please let me know.

Could not find system(darwin) default encoding. Please check it manually and report your environment to the Padre development team. at /opt/local/lib/perl5/site_perl/5.10.0/Padre/ line 139, <$fh> line 1.

laylward:~ leedo$ locale

comment:2 Changed 11 years ago by szabgab

I am afraid it is a Wx vs Mac issue.

Please try these

perl -MWx -le'print Wx::Locale::GetSystemLanguage'

wperl -MWx -le'print Wx::Locale::GetSystemLanguage'

comment:3 Changed 11 years ago by leedo

Both of those print out '58'. Should I take this up with the Wx team then?


comment:4 Changed 11 years ago by stennie

  • Cc stennie@… added

I have a similar problem trying Padre 0.23.

>  wxperl -MWx -le'print Wx::Locale::GetSystemLanguage'

locale info is:


However .. I found a curious problem in Padre::Locale::encoding_system_default().

For Mac there's a fallback check using POSIX at Padre/Locale?.pm line 250:

my $loc = POSIX::setlocale(POSIX::LC_CTYPE());

From a command line or simple test script this returns the expected value:

> wxperl -MPOSIX -e'print POSIX::setlocale(POSIX::LC_CTYPE())'

If I dump the value of $loc when Padre is running, $loc is determined as "en_US" so will fail to match the expected format.

A temporary fix is to allow the default en_US encoding:

--- Padre/	2009-01-05 01:57:00.000000000 +1100
+++ Padre/	2009-01-06 23:48:39.000000000 +1100
@@ -248,7 +248,7 @@
 		# Use LC_CTYPE to guess system default encoding.
 		require POSIX;
 		my $loc = POSIX::setlocale(POSIX::LC_CTYPE());
-		if ( $loc =~ m/^(C|POSIX)/i ) {
+		if ( $loc =~ m/^(C|POSIX|en_US$)/i ) {
 			$encoding = 'ascii';
 		elsif ( $loc =~ /\./ ) {


comment:5 Changed 11 years ago by leedo

After some more messing around I have found that $loc gets set to en_GB for me by the above POSIX calls. Maybe there is an off-by-one error in POSIX on OS X? Anyways, by setting the above fix to allow en_GB on Mac I can avoid the warnings.

However, it seems none of these encoding issues are not the cause of problem for me. When I launch Padre as root I get a blank document and can open new documents (with and without the above edits.) When I launch as my regular user I do not get a blank document and I can not open other documents. Perhaps there is some sort of permissions problem in /tmp that isn't getting cleaned up?

comment:6 Changed 11 years ago by leedo

laylward:~ leedo$ perl -e 'use POSIX; my $loc = POSIX::setlocale(POSIX::LC_CTYPE); print "$loc\n";'
laylward:~ leedo$ perl -e 'require POSIX; my $loc = POSIX::setlocale(POSIX::LC_CTYPE); print "$loc\n";'

This seems rather odd but still doesn't explain why $loc is getting set to en_GB.

comment:7 Changed 11 years ago by azawawi

Can you please test if this bug is still valid with Padre 0.46 ?

Have a nice day :)

comment:8 Changed 10 years ago by kaib

  • Version changed from 0.22 to 0.50

Still present on Padre 0.50

seems like the problem is that POSIX is required, not used:

> perl -e 'use POSIX; my $loc = POSIX::setlocale(POSIX::LC_CTYPE); print "$loc\n";'
> perl -e 'require POSIX; my $loc = POSIX::setlocale(POSIX::LC_CTYPE); print "$loc\n";'

comment:9 Changed 9 years ago by bowtie

  • Keywords osx added

comment:10 Changed 8 years ago by bowtie

  • Owner set to tome, bennie
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.