UTF-8 issue?? for Exiftool -listx output under Win 11

Started by ScannerBoy, September 19, 2024, 03:07:20 PM

Previous topic - Next topic

ScannerBoy

In the past, running under Win 10' in a DOS box, I was able to generate a valid XML file from
exiftool -s -f -listx >listx-s-f.xml.
When I run the same command under Win 11, using the command line at the Powershell prompt:
C:\Program Files\ExifTool\ph> ./exiftool.exe -s -f -listx >d:\listx-s-f-12_96.xml
where "C:\Program Files\ExifTool\ph" is the location of the latest Exiftool executable (12.96),
I get an output file which some XML validators accept and some other libraries do not.
For the output in a hex editor, see the attached screensho.:

My main issue is that the wxWidgets XML libraries refuse to load the XML file.

In the past I had to execute
$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
to properly render the Exiftool output as UTF-8.

However, even with that command preceding the listx output, the resulting XML file ends up with the exact same content.


FrankB

Your output looks UTF16 to me. (2 bytes for 1 char)

If I execute it (also WIn11) from a cmd window, I get UTF8
If I execute it from Powershell I get UTF16.

If I replace
$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8with
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' in Powershell I get UTF-8

https://stackoverflow.com/questions/40098771/changing-powershells-default-output-encoding-to-utf-8

ScannerBoy

Thank you very much for that explanation.

My take away: the XML validators I checked are correct and I need to take up the issue with the wxWidgets XML library developers.