[GRASS-dev] [GRASS GIS] #3726: special characters in psmap scalebar unit

#3726: special characters in psmap scalebar unit
-------------------------+---------------------------------
Reporter: 1266 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Default | Version: svn-releasebranch76
Keywords: | CPU: Unspecified
Platform: Unspecified |
-------------------------+---------------------------------
special characters are not correctly displayed for psmap module scalebar.
For example:
scalebar s
     units kilometers
     ...
does not display special characters of kilom[è]tres in french.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3726&gt;
GRASS GIS <https://grass.osgeo.org>

#3726: special characters in psmap scalebar unit
--------------------------+---------------------------------
  Reporter: 1266 | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: svn-releasebranch76
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by veroandreo):

To reproduce:

1. Go to Settings -> Preferences, under Appearance tab, set Language to
French or Spanish, for example. Save and Exit GRASS.

2. Start a new GRASS session in NC location and save the following
instructions in `test.psmap`
{{{
# timestamp: 2019-01-07 15:24
# location: nc_basic_spm_grass7
# mapset: PERMANENT
# page orientation: Portrait
# g.region raster=elevation@PERMANENT nsres=10.0 ewres=10.0

maploc 1.014 1.295 6.205 5.585
border y
     width 1
     color black
     end

paper a4
     left 0.5
     right 0.5
     bottom 1
     top 1
     end

raster elevation@PERMANENT
scalebar f
     where 5.916 7.327
     length 5.0
     units kilometers
     height 0.1
     segment 4
     numbers 1
     fontsize 10
     background y
     end
end
}}}

3. Run `ps.map in=test.psmap out=test.ps` or load the instructions file in
G7:g.gui.psmap and see the preview.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3726#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3726: special characters in psmap scalebar unit
--------------------------+---------------------------------
  Reporter: 1266 | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: svn-releasebranch76
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [ticket:3726 1266]:
> special characters are not correctly displayed for psmap module
scalebar.
> For example:
> scalebar s
> units kilometers
> ...
> does not display special characters of kilom[è]tres in french.

Just guessing here, but could it be that the translated strings (po files)
are in UTF-8 while ps.map expects all strings to be iso-8859-1 ? In
[https://trac.osgeo.org/grass/browser/grass/trunk/ps/ps.map/do_scalebar.c#L193
do_scalebar.c] there is:

{{{
193 else if(sb.units == SB_UNITS_KM)
194 strcpy(num, _("kilometers"));
}}}

so kilometers is translated and that's why you automatically get the non-
ascii characters, but in a different encoding than the one expected.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3726#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>