Skip to content

listxml file encoding different between cmd.exe and Powershell #5694

@darkshade9

Description

@darkshade9

Hi,

Thanks for all the hard work on this project!

I was wrestling with an issue for weeks now and in communication with the creator of LEDBlinky, that LEDBlinky was unable to load clones from the file that listxml creates. He discovered it was due to a file encoding issue.

Sure enough when I checked, sending output to a file via mame64.exe -listxml > mame.xml in cmd.exe produces a ~221MB file of ANSI (listxml.xml: XML 1.0 document, ASCII text, with CRLF line terminators)
Doing the same in Powershell produces a ~442MB file of UTF-16 (pslistxml.xml: XML 1.0 document, Little-endian UTF-16 Unicode text, with CRLF line terminators)

Is this simply due to differences in sending output to a file or does mame64.exe defer to the shell you're in to determine which encoding the file gets?

Activity

cuavas

cuavas commented on Oct 1, 2019

@cuavas
Member

MAME sends UTF-8 to standard output most of the time, including for the -listxml verb. Trying to deal with anything other than ASCII on Windows is a mess. The attempts to improve the situation in imgtool seem to have actually made things worse on Windows. If you're having trouble with -listxml output, I'd recommend downloading the XML file from a release on GitHub or SourceForge.

angelosa

angelosa commented on Feb 24, 2022

@angelosa
Member

In PowerShell you can change the default stdout pipe encoding by explicitly change the UTF-16 default with this:

$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
SO question

If you absolutely have to use the legacy CMD terminal instead it's still kinda trivial to fix instead, cfr. SU thread. If you need something more involved with CMD then at that point I'd suggest you can achieve same results with a Python script with subprocess PSL instead.

Bottom line: this sounds very wontfix league to me, pending closure unless something significant needs to be added here.

cuavas

cuavas commented on Feb 24, 2022

@cuavas
Member

Bottom line: this sounds very wontfix league to me.

It’s more “can’t practically fix unless we drop support for everything before Win10 1909”. Not sure if we really care about keeping this particular issue open.

darkshade9

darkshade9 commented on Feb 24, 2022

@darkshade9
Author

I think the workarounds discussed here are sufficient, I don't see a good reason to spend dev cycles 'fixing' it. Perhaps a blurb in the documentation for this functionality would be enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation-related issueswontfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @darkshade9@angelosa@cuavas

        Issue actions

          listxml file encoding different between cmd.exe and Powershell · Issue #5694 · mamedev/mame