Ticket #191 (assigned defect)

Opened 5 years ago

Last modified 20 months ago

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@…

Description

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:

http://pastie.org/349236

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

comment:1 Changed 5 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/Locale.pm line 139, <$fh> line 1.

laylward:~ leedo$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

comment:2 Changed 5 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 5 years ago by leedo

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

Thanks!

comment:4 Changed 5 years ago by stennie

  • Cc stennie@… added

I have a similar problem trying Padre 0.23.

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

locale info is:

LANG="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_CTYPE="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_ALL=

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())'
en_AU.UTF-8

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/Locale.pm.dist	2009-01-05 01:57:00.000000000 +1100
+++ Padre/Locale.pm	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 =~ /\./ ) {

Cheers,
Stephen

comment:5 Changed 5 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 5 years ago by leedo

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

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

comment:7 Changed 5 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 4 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";'
de_DE.UTF-8
> perl -e 'require POSIX; my $loc = POSIX::setlocale(POSIX::LC_CTYPE); print "$loc\n";'
de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

comment:9 Changed 3 years ago by bowtie

  • Keywords osx added

comment:10 Changed 20 months ago by bowtie

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