[MacPorts] #70670: iconv on macOS Ventura 13.6+ does not perform correct conversions

MacPorts noreply at macports.org
Sat Aug 31 22:51:35 UTC 2024


#70670: iconv on macOS Ventura 13.6+ does not perform correct conversions
----------------------------------------+----------------------------
  Reporter:  seamusdemora               |      Owner:  (none)
      Type:  defect                     |     Status:  new
  Priority:  Normal                     |  Milestone:
 Component:  ports                      |    Version:  2.10.1
Resolution:                             |   Keywords:  iconv libiconv
      Port:  libiconv @1.17_0 (active)  |
----------------------------------------+----------------------------
Description changed by seamusdemora:

Old description:

> I'm trying to do something that seems simple (it can be done simply on my
> Linux box):
>
> I have C&P a line from a PDF file (a French programming guide), to
> Terminal.app:
> 'print("Numéro de boucle", i)'
>
> I wanted to convert this line to ASCII before pasting into my editor. So
> I used 'iconv' as shown below. In each case, I used 'file' to check the
> "from" encoding :
>
> {{{
> % echo 'print("Numéro de boucle", i)' | file -
> /dev/stdin: Unicode text, UTF-8 text
>
> % echo 'print("Numéro de boucle", i)' | iconv -f utf-8 -t ascii//translit
> print("Num'ero de boucle", i)
>
> ?!?!?!?   I tried another example:
>
> % echo "print("Protégé. Señorita. Coup de grâce", i)" | file -
> /dev/stdin: Unicode text, UTF-8 text
>
> % echo 'Protégé Señorita Coup de grâce' | iconv -f UTF-8 -t
> ASCII//TRANSLIT
> Prot'eg'e Se~norita Coup de gr^ace
> }}}
>
> As you can see, this is not correct: a single quote has been added. I'm
> not a frequent user of 'iconv', so I checked this on my Debian 'bookworm'
> Linux box:
>
> {{{
> $ echo 'print("Numéro de boucle", i)' | iconv -f utf-8 -t ascii//translit
> print("Numero de boucle", i)
> }}}
>
> I've checked to confirm that the version of 'iconv' on my macOS Ventura
> 13.6+ is one from MacPorts. I believe that it is:
>
> {{{
> % whereis iconv
> iconv: /usr/bin/iconv /opt/local/share/man/man1/iconv.1.gz
>
> % port installed requested
> The following ports are currently installed:
> ...
> libiconv @1.17_0 (active)
> ...
> %
> }}}
>
> And confirmation of my macports version:
> {{{
> % port -v
> MacPorts 2.10.1
> }}}
>
> I can accept that it's broken, and I can accept that it can't be fixed
> (if that turns out to be the case). But I surely would appreciate an
> explanation of what has gone wrong - especially if it's something that I
> am doing incorrectly!
>
> Rgds,
> ~S

New description:

 I'm trying to do something that seems simple (it can be done simply on my
 Linux box):

 I have C&P a line from a PDF file (a French programming guide), to
 Terminal.app:
 'print("Numéro de boucle", i)'

 I wanted to convert this line to ASCII before pasting into my editor. So I
 used 'iconv' as shown below. In each case, I used 'file' to check the
 "from" encoding :

 {{{
 % echo 'print("Numéro de boucle", i)' | file -
 /dev/stdin: Unicode text, UTF-8 text

 % echo 'print("Numéro de boucle", i)' | iconv -f utf-8 -t ascii//translit
 print("Num'ero de boucle", i)

 ?!?!?!?   I tried another example:

 % echo "print("Protégé. Señorita. Coup de grâce", i)" | file -
 /dev/stdin: Unicode text, UTF-8 text

 % echo 'Protégé Señorita Coup de grâce' | iconv -f UTF-8 -t
 ASCII//TRANSLIT
 Prot'eg'e Se~norita Coup de gr^ace
 }}}

 **PLEASE NOTE: I have also tried using 'utf-8-mac' and 'utf8-mac' for the
 "from" encoding; thhis had no effect on the results - they were identical
 in all cases.**

 As you can see, this is not correct: a single quote has been added. I'm
 not a frequent user of 'iconv', so I checked this on my Debian 'bookworm'
 Linux box:

 {{{
 $ echo 'print("Numéro de boucle", i)' | iconv -f utf-8 -t ascii//translit
 print("Numero de boucle", i)
 }}}

 I've checked to confirm that the version of 'iconv' on my macOS Ventura
 13.6+ is one from MacPorts. I believe that it is:

 {{{
 % whereis iconv
 iconv: /usr/bin/iconv /opt/local/share/man/man1/iconv.1.gz

 % port installed requested
 The following ports are currently installed:
 ...
 libiconv @1.17_0 (active)
 ...
 %
 }}}

 And confirmation of my macports version:
 {{{
 % port -v
 MacPorts 2.10.1
 }}}

 I can accept that it's broken, and I can accept that it can't be fixed (if
 that turns out to be the case). But I surely would appreciate an
 explanation of what has gone wrong - especially if it's something that I
 am doing incorrectly!

 Rgds,
 ~S

--

-- 
Ticket URL: <https://trac.macports.org/ticket/70670#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list