Skip to content

Format-Hex help topic needs several improvements #2955

@mklement0

Description

@mklement0
  • The -Raw switch:

  • -InputObject / pipeline input supports only a limited number of input types, which should be documented:

  • The -Encoding parameter:

    • is incorrectly described in general: its true purpose is to control the output encoding whose byte representation to output, and it only applies to input objects received via the pipeline (whereas input read directly from a file is always output as the file's raw byte representation).

      • additionally, it only applies to [string] input; with any of the supported numeric types, -Encoding has no effect.
    • is incorrectly described as defaulting to Unicode; the true defaults are:

      • Windows PowerShell: ASCII; note that that means that non-ASCII characters in the input are output as literal ? chars. (single 0x3F bytes), resulting in a loss of information.

      • PowerShell Core: UTF-8

Additionally, it makes sense to explain the limitations of the right-most column that tries to render the bytes as characters:

  • Generally, each byte is interpreted as a Unicode code point, which means that:
    • (printable) ASCII[-range] characters are always printed correctly, as themselves.
    • multi-byte UTF-8 characters never render correctly
    • UTF-16 characters render correctly only if their high byte happens be NUL.

Version(s) of document impacted

  • Impacts 6.next document
  • Impacts 6 document
  • Impacts 5.1 document
  • Impacts 5.0 document
  • Impacts 4.0 document
  • Impacts 3.0 document

Reason(s) for not selecting all version of documents

  • The documented feature was introduced in selected version of PowerShell
  • This issue only shows up in selected version of the document

Metadata

Metadata

Assignees

Labels

Pri2Priority - Mediumarea-utilityArea - Microsoft.PowerShell.Utility module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions