logo separator

[mkgmap-dev] Option --latin1 not working any more?

From Ævar Arnfjörð Bjarmason avarab at gmail.com on Thu Mar 12 19:49:36 GMT 2009

On Thu, Mar 12, 2009 at 5:45 PM, Johann Gail <johann.gail at gmx.de> wrote:
>
>
>> His patch:
>>
>>       } else if (name.equals("CodePage")) {
>> -            if (!value.equals("1252"))
>> -                dec = Charset.forName("cp" + value).newDecoder();
>> +            dec = Charset.forName("cp" + value).newDecoder();
>>
>> Seems to only set the character set when there's a CodePage key in the
>> file, osm2mp.pl does not output any when run with --nocodepage.
>>
>> I tried running osm2mp.pl --nocodepage and mkgmap --latin1 on an osm
>> export recently and all the non-ascii characters were screwed up, it
>> worked again with --codepage 1252 though.
>>
>>
>
> The important part of the patch not this part, but the line in the beginning
> of the file.  With this the default encoding gets changed to UTF8.
>
> -    private static final String READING_CHARSET = "iso-8859-1";
> +    private static final String READING_CHARSET = "UTF-8";
>
>
> Only if there is an explicit codepage given in the mp file, then the
> encoding gets changed to another charset.
>
> If it does not work for you, then please check the encoding of the mp file.
> There should be on each occurence of an umlaut two characters. Then it is
> UTF8. If this is not the case, then it has some other encoding.

Looks like I screwed something up, --nocodepage will produce a UTF-8 .mp file:

mkdir -p /tmp/garmin-export
cd !$
wget "http://api.openstreetmap.org/api/0.5/map?bbox=-22.093,64.025,-21.594,64.203"
-O reykjavik.osm
cd ~/src/osm2mp
avar at t:~/src/osm2mp$ svn up
At revision 49.
avar at t:~/src/osm2mp$ perl osm2mp.pl --nocodepage
/tmp/garmin-export/reykjavik.osm > /tmp/garmin-export/reykjavik.mp

  ---|   OSM -> MP converter  0.70a   (c) 2008,2009  liosha, xliosha at gmail.com

Processing file /tmp/garmin-export/reykjavik.osm

Loading nodes...          33070 loaded, 769 POIs dumped
Loading relations...      3 multipolygons, 0 turn restrictions
Loading holes...          4 loaded
Processing ways...        4372 roads and 0 coastlines loaded
                          63 lines and 326 polygons dumped
Merging roads...          389 merged
Detecting road nodes...   7083 found
Detecting duplicates...   73 segments, 37 roads
Splitting roads...        247 self-intersections, 0 long roads
Fixing close nodes...     302 pairs fixed
Writing roads...          4230 written
Writing restrictions...   0 written
All done!!

avar at t:/tmp/garmin-export$ file reykjavik.mp
reykjavik.mp: UTF-8 Unicode English text
avar at t:/tmp/garmin-export$ grep Álftanes$ reykjavik.mp |hexdump -C
00000000  4c 61 62 65 6c 3d c3 81  6c 66 74 61 6e 65 73 0a  |Label=..lftanes.|
00000010

avar at t:/tmp/garmin-export/mp$ java -jar ~/src/mkgmap/dist/mkgmap.jar
--description="OSM Reykjavik MP" --latin1 --gmapsupp ../reykjavik.mp

And the resulting gmapsupp.img doesn't have encoding problems:

http://u.nix.is/mp/gmapsupp.img



More information about the mkgmap-dev mailing list