Re: GPSbabel mishandles files with utf-8 names.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Steve Elliott
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

tsteven4-2
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Steve Elliott
tsteven4, 

Thanks for your response.

I have:
 
[steve@Regret ~]$ locale
LANG=en_AU.utf8
LC_CTYPE="en_AU.utf8"
LC_NUMERIC=en_AU.utf8
LC_TIME=en_AU.utf8
LC_COLLATE="en_AU.utf8"
LC_MONETARY=en_AU.utf8
LC_MESSAGES="en_AU.utf8"
LC_PAPER=en_AU.utf8
LC_NAME="en_AU.utf8"
LC_ADDRESS="en_AU.utf8"
LC_TELEPHONE="en_AU.utf8"
LC_MEASUREMENT=en_AU.utf8
LC_IDENTIFICATION="en_AU.utf8"
LC_ALL=
 
[steve@Regret ~]$ uname -srv
Linux 3.18.7-100.fc20.x86_64 #1 SMP Wed Feb 11 19:01:50 UTC 2015

 

Regards
Steve


On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Steve Elliott
In reply to this post by tsteven4-2
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc

GPSbabel_utf-8_fault (664 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Robert Lipe-4
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

tsteven4-2
This works, i.e. I couldn't reproduce the error, on my fc19 vm, which is pretty close to fc20 that the error was reported with.

On 3/12/2015 11:44 PM, Robert Lipe wrote:
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc




------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Steve Elliott
tsteven4 & Robert,

Many thanks for your input.

I have done some further investigation:

[steve@Regret GPSfault]$ echo "<kml></kml>" >Château.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ ls -l
total 4
-rw-rw-r-- 1 steve steve 12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a           |Ch..teau.kml.|
0000000d
A file named with utf-8 is rejected by -f input file name option.

Work around that by using stdin:
 

[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F Château.gpx <Château.kml 
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:49 Chteau.gpx
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a                           |eau.gpx.|
00000018
Note that the -F output filename option is accepted but has the accented character edited out.

Does the -f option do similar editing and look for a different file?


[steve@Regret GPSfault]$ cp Château.kml Chteau.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
[steve@Regret GPSfault]$ ls -l
total 12
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:52 Chteau.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:51 Chteau.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a  43 68 74 65 61 75 2e 6b  |eau.gpx.Chteau.k|
00000020  6d 6c 0a                                          |ml.|
00000023
Yes!

Inspecting the source:

gpsbabel-1.5.2.tar.gz::/src/core/file.h implements gpsbabel::File based on QtCore::QFile.
gpsbabel::File::open calls QFile::open which internally edits out the accent character.
QFile::filename is left intact as shown by the error message.

So it seems to be a Qt fault on my machine.

My libQtCore.so.4.8.6 is provided by 4.8.6-25.fc20 from the Fedora 20 updates repository.
My gpsbabel is 1.5.2-1.fc20 from the Fedora20 updates repository.

A full work around is to use stdin & stdout for file selection.
 

[steve@Regret GPSfault]$ rm Cht*
[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F - <Château.kml >Château.gpx
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve 193 Mar 14 11:53 Château.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 67 70 78 0a 43 68 c3  |Ch..teau.gpx.Ch.|
00000010  a2 74 65 61 75 2e 6b 6d  6c 0a                    |.teau.kml.|
0000001a
[steve@Regret GPSfault]$ 


I also tried 3 different locales and they all fail.
 
[steve@Regret GPSfault]$ export LC_ALL="en_AU.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=en_AU.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANGUAGE=en_US.UTF-8
[steve@Regret GPSfault]$ export LC_ALL="en_US.UTF-8"
[steve@Regret GPSfault]$ export LANG=en_US.UTF-8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANG=fr_FR.utf8
[steve@Regret GPSfault]$ export LC_ALL="fr_FR.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=fr_FR.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ 


On 13 March 2015 at 23:46, tsteven4 <[hidden email]> wrote:
This works, i.e. I couldn't reproduce the error, on my fc19 vm, which is pretty close to fc20 that the error was reported with.

On 3/12/2015 11:44 PM, Robert Lipe wrote:
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc





------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

Robert Lipe-4
For a possible workaround, try replacing
      status =  QFile::open(mode);$
with
      status =  QFile::open(QString::fromUtf8(mode));$



On Fri, Mar 13, 2015 at 7:55 PM, Steve Elliott <[hidden email]> wrote:
tsteven4 & Robert,

Many thanks for your input.

I have done some further investigation:

[steve@Regret GPSfault]$ echo "<kml></kml>" >Château.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ ls -l
total 4
-rw-rw-r-- 1 steve steve 12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a           |Ch..teau.kml.|
0000000d
A file named with utf-8 is rejected by -f input file name option.

Work around that by using stdin:
 

[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F Château.gpx <Château.kml 
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:49 Chteau.gpx
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a                           |eau.gpx.|
00000018
Note that the -F output filename option is accepted but has the accented character edited out.

Does the -f option do similar editing and look for a different file?


[steve@Regret GPSfault]$ cp Château.kml Chteau.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
[steve@Regret GPSfault]$ ls -l
total 12
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:52 Chteau.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:51 Chteau.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a  43 68 74 65 61 75 2e 6b  |eau.gpx.Chteau.k|
00000020  6d 6c 0a                                          |ml.|
00000023
Yes!

Inspecting the source:

gpsbabel-1.5.2.tar.gz::/src/core/file.h implements gpsbabel::File based on QtCore::QFile.
gpsbabel::File::open calls QFile::open which internally edits out the accent character.
QFile::filename is left intact as shown by the error message.

So it seems to be a Qt fault on my machine.

My libQtCore.so.4.8.6 is provided by 4.8.6-25.fc20 from the Fedora 20 updates repository.
My gpsbabel is 1.5.2-1.fc20 from the Fedora20 updates repository.

A full work around is to use stdin & stdout for file selection.
 

[steve@Regret GPSfault]$ rm Cht*
[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F - <Château.kml >Château.gpx
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve 193 Mar 14 11:53 Château.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 67 70 78 0a 43 68 c3  |Ch..teau.gpx.Ch.|
00000010  a2 74 65 61 75 2e 6b 6d  6c 0a                    |.teau.kml.|
0000001a
[steve@Regret GPSfault]$ 


I also tried 3 different locales and they all fail.
 
[steve@Regret GPSfault]$ export LC_ALL="en_AU.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=en_AU.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANGUAGE=en_US.UTF-8
[steve@Regret GPSfault]$ export LC_ALL="en_US.UTF-8"
[steve@Regret GPSfault]$ export LANG=en_US.UTF-8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANG=fr_FR.utf8
[steve@Regret GPSfault]$ export LC_ALL="fr_FR.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=fr_FR.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ 


On 13 March 2015 at 23:46, tsteven4 <[hidden email]> wrote:
This works, i.e. I couldn't reproduce the error, on my fc19 vm, which is pretty close to fc20 that the error was reported with.

On 3/12/2015 11:44 PM, Robert Lipe wrote:
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc






------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

tsteven4-2
FC19 fails with qt 4.8.6 as originally described by Steve Elliott.
FC19 works with qt 5.3.2 as I previously reported.
Note that both version of qt are in fedora updates for fc19.  Both versions can coexist.  Our configure script prefers Qt 5.  So an easy workaround seems to be to get Qt5 from the fedora repo and run configure and make again.

Qt 5 made encoding related changes, e.g. fromAscii -> fromUtf8 for QString conversions from char *s.  We have attempted to make Qt4 work like Qt5 so we wouldn't see differences like this, but evidently we didn't cover this case.

On 3/14/2015 12:12 AM, Robert Lipe wrote:
For a possible workaround, try replacing
      status =  QFile::open(mode);$
with
      status =  QFile::open(QString::fromUtf8(mode));$



On Fri, Mar 13, 2015 at 7:55 PM, Steve Elliott <[hidden email]> wrote:
tsteven4 & Robert,

Many thanks for your input.

I have done some further investigation:

[steve@Regret GPSfault]$ echo "<kml></kml>" >Château.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ ls -l
total 4
-rw-rw-r-- 1 steve steve 12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a           |Ch..teau.kml.|
0000000d
A file named with utf-8 is rejected by -f input file name option.

Work around that by using stdin:
 

[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F Château.gpx <Château.kml 
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:49 Chteau.gpx
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a                           |eau.gpx.|
00000018
Note that the -F output filename option is accepted but has the accented character edited out.

Does the -f option do similar editing and look for a different file?


[steve@Regret GPSfault]$ cp Château.kml Chteau.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
[steve@Regret GPSfault]$ ls -l
total 12
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:52 Chteau.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:51 Chteau.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a  43 68 74 65 61 75 2e 6b  |eau.gpx.Chteau.k|
00000020  6d 6c 0a                                          |ml.|
00000023
Yes!

Inspecting the source:

gpsbabel-1.5.2.tar.gz::/src/core/file.h implements gpsbabel::File based on QtCore::QFile.
gpsbabel::File::open calls QFile::open which internally edits out the accent character.
QFile::filename is left intact as shown by the error message.

So it seems to be a Qt fault on my machine.

My libQtCore.so.4.8.6 is provided by 4.8.6-25.fc20 from the Fedora 20 updates repository.
My gpsbabel is 1.5.2-1.fc20 from the Fedora20 updates repository.

A full work around is to use stdin & stdout for file selection.
 

[steve@Regret GPSfault]$ rm Cht*
[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F - <Château.kml >Château.gpx
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve 193 Mar 14 11:53 Château.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 67 70 78 0a 43 68 c3  |Ch..teau.gpx.Ch.|
00000010  a2 74 65 61 75 2e 6b 6d  6c 0a                    |.teau.kml.|
0000001a
[steve@Regret GPSfault]$ 


I also tried 3 different locales and they all fail.
 
[steve@Regret GPSfault]$ export LC_ALL="en_AU.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=en_AU.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANGUAGE=en_US.UTF-8
[steve@Regret GPSfault]$ export LC_ALL="en_US.UTF-8"
[steve@Regret GPSfault]$ export LANG=en_US.UTF-8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANG=fr_FR.utf8
[steve@Regret GPSfault]$ export LC_ALL="fr_FR.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=fr_FR.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ 


On 13 March 2015 at 23:46, tsteven4 <[hidden email]> wrote:
This works, i.e. I couldn't reproduce the error, on my fc19 vm, which is pretty close to fc20 that the error was reported with.

On 3/12/2015 11:44 PM, Robert Lipe wrote:
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc







------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc
Reply | Threaded
Open this post in threaded view
|

Re: GPSbabel mishandles files with utf-8 names.

tsteven4-2
You can force Qt 4.8.6 to work by forcing the codecForLocale to UTF-8.

On fc19 with Qt 4.8.6 on my system the codecForLocale comes up as System.  It seems like System should have reflected the locale, in my case en_US.utf8, and worked, but apparently not.
On fc19 with Qt 5.3.2 on my system the codecForLocale comes up as UTF-8.

I am not convinced that this is a good idea, the patch is just to make it easier for someone else to play with this idea.

On 3/14/2015 8:29 AM, tsteven4 wrote:
FC19 fails with qt 4.8.6 as originally described by Steve Elliott.
FC19 works with qt 5.3.2 as I previously reported.
Note that both version of qt are in fedora updates for fc19.  Both versions can coexist.  Our configure script prefers Qt 5.  So an easy workaround seems to be to get Qt5 from the fedora repo and run configure and make again.

Qt 5 made encoding related changes, e.g. fromAscii -> fromUtf8 for QString conversions from char *s.  We have attempted to make Qt4 work like Qt5 so we wouldn't see differences like this, but evidently we didn't cover this case.

On 3/14/2015 12:12 AM, Robert Lipe wrote:
For a possible workaround, try replacing
      status =  QFile::open(mode);$
with
      status =  QFile::open(QString::fromUtf8(mode));$



On Fri, Mar 13, 2015 at 7:55 PM, Steve Elliott <[hidden email]> wrote:
tsteven4 & Robert,

Many thanks for your input.

I have done some further investigation:

[steve@Regret GPSfault]$ echo "<kml></kml>" >Château.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ ls -l
total 4
-rw-rw-r-- 1 steve steve 12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a           |Ch..teau.kml.|
0000000d
A file named with utf-8 is rejected by -f input file name option.

Work around that by using stdin:
 

[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F Château.gpx <Château.kml 
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:49 Chteau.gpx
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a                           |eau.gpx.|
00000018
Note that the -F output filename option is accepted but has the accented character edited out.

Does the -f option do similar editing and look for a different file?


[steve@Regret GPSfault]$ cp Château.kml Chteau.kml 
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
[steve@Regret GPSfault]$ ls -l
total 12
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
-rw-rw-r-- 1 steve steve 193 Mar 14 11:52 Chteau.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:51 Chteau.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 6b 6d 6c 0a 43 68 74  |Ch..teau.kml.Cht|
00000010  65 61 75 2e 67 70 78 0a  43 68 74 65 61 75 2e 6b  |eau.gpx.Chteau.k|
00000020  6d 6c 0a                                          |ml.|
00000023
Yes!

Inspecting the source:

gpsbabel-1.5.2.tar.gz::/src/core/file.h implements gpsbabel::File based on QtCore::QFile.
gpsbabel::File::open calls QFile::open which internally edits out the accent character.
QFile::filename is left intact as shown by the error message.

So it seems to be a Qt fault on my machine.

My libQtCore.so.4.8.6 is provided by 4.8.6-25.fc20 from the Fedora 20 updates repository.
My gpsbabel is 1.5.2-1.fc20 from the Fedora20 updates repository.

A full work around is to use stdin & stdout for file selection.
 

[steve@Regret GPSfault]$ rm Cht*
[steve@Regret GPSfault]$ gpsbabel -i kml -f - -o gpx -F - <Château.kml >Château.gpx
[steve@Regret GPSfault]$ ls -l
total 8
-rw-rw-r-- 1 steve steve 193 Mar 14 11:53 Château.gpx
-rw-rw-r-- 1 steve steve  12 Mar 14 11:44 Château.kml
[steve@Regret GPSfault]$ ls -1 | hexdump -C
00000000  43 68 c3 a2 74 65 61 75  2e 67 70 78 0a 43 68 c3  |Ch..teau.gpx.Ch.|
00000010  a2 74 65 61 75 2e 6b 6d  6c 0a                    |.teau.kml.|
0000001a
[steve@Regret GPSfault]$ 


I also tried 3 different locales and they all fail.
 
[steve@Regret GPSfault]$ export LC_ALL="en_AU.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=en_AU.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANGUAGE=en_US.UTF-8
[steve@Regret GPSfault]$ export LC_ALL="en_US.UTF-8"
[steve@Regret GPSfault]$ export LANG=en_US.UTF-8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ export LANG=fr_FR.utf8
[steve@Regret GPSfault]$ export LC_ALL="fr_FR.utf8"
[steve@Regret GPSfault]$ export LANGUAGE=fr_FR.utf8
[steve@Regret GPSfault]$ gpsbabel -i kml -f Château.kml -o gpx -F Château.gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.
[steve@Regret GPSfault]$ 


On 13 March 2015 at 23:46, tsteven4 <[hidden email]> wrote:
This works, i.e. I couldn't reproduce the error, on my fc19 vm, which is pretty close to fc20 that the error was reported with.

On 3/12/2015 11:44 PM, Robert Lipe wrote:
It's probably something Linux-specific.  Though I'm on the road, I just ran this on my Mac.



$ touch Château.kml
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$ export LC_ALL=en_AU.utf8
$ ./gpsbabel -i kml -f Château.kml
XML Reader:Read error: Premature end of document. (Château.kml, line 1, col 0)
$

"But wait, you got an error, too!."   Well, yeah, but it's an error that indicated it could open and read the file. OK, with a "better" KML file.


$ echo "<kml></kml>" > Château.kml
$ ./gpsbabel -i kml -f Château.kml
$

That's actually a bit odd.  For all the character set wanking we sometimes do on the data itself, filenames from the command line are pretty straight-forward argv[x]  passed to open().

On Thu, Mar 12, 2015 at 6:02 PM, Steve Elliott <[hidden email]> wrote:
It looks like some email clients may also not render the utf-8 character correctly.

Here is a file of my console report.

Regards

Steve

On 13 March 2015 at 08:43, tsteven4 <[hidden email]> wrote:
This seems to work fine for me.  What is your locale?

Qt 5.4.0, locale en_US.utf8, Centos 7, Revision: 4977.

On 3/12/2015 12:35 AM, Steve Elliott wrote:
On 12/03/2015 5:19 PM, "Steve Elliott" <[hidden email]> wrote:
All,

I have prepared some Google My Maps layers for my planned trip in France & find that files named after my destinations are rejected by GPSbabel if they contain common utf-8 encoded accented characters in the filename.

[steve@Regret ~]$ gpsbabel -V
GPSBabel Version 1.5.2

[steve@Regret ~]$ cp Château.kml Chateau.kml 
[steve@Regret ~]$ ll
total 172
-rw-r--r-- 1 steve steve 84250 Mar 12 16:50 Chateau.kml
-rw-r--r-- 1 steve steve 84250 Mar  9 21:41 Château.kml

[steve@Regret ~]$ gpsbabel -w -i kml -f Château.kml -x nuketypes,tracks -o gpx
Cannot open 'Château.kml' for read.  Error was 'No such file or directory'.

[steve@Regret ~]$ gpsbabel -w -i kml -f Chateau.kml -x nuketypes,tracks -o gpx

 
Can anyone suggest what I am doing wrong?  Or is this a (known?) fault?

Regards
Steve



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc








------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
[hidden email]
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc

lc.txt (1006 bytes) Download Attachment