iainbrighton/PScribo

Escape characters displayed in 'Text' output

Closed this issue · 2 comments

When exporting documents to Text format, escape characters are shown within the output.

Running the following

[CmdletBinding()]
param (
    [System.String[]] $Format = 'Text',
    [System.String] $Path = "$env:USERPROFILE\documents",
    [System.Management.Automation.SwitchParameter] $PassThru
)

Import-Module PScribo -Force -Verbose:$false

$example17 = Document -Name 'PScribo Example 17' {

    <#
        To create a multi-row table from hashtables, simply create a collection/
        array of ordered hashtables.

        NOTE: You must ensure that the hashtable keys are the same on all hashtables
              in the collection/array as only the first object is enumerated.

        The following example creates an table with a three rows from an array of
        ordered hashtables.
    #>
    $hashtableArray = @(
        [Ordered] @{ 'Column 1' = 'Some random text'; 'Column2' = 345; 'Custom Property' = $true; }
        [Ordered] @{ 'Column 1' = 'Random some text'; 'Column2' = 16; 'Custom Property' = $false; }
        [Ordered] @{ 'Column 1' = 'Text random some'; 'Column2' = 1GB; 'Custom Property' = $true; }
    )
    Table -Hashtable $hashtableArray -List -Key 'Column 1' -ColumnWidths 20, 40, 40
}
$example17 | Export-Document -Path $Path -Format $Format -PassThru:$PassThru

will result in

�[32;1mColumn 1         Column2    Custom Property�[0m
�[32;1m--------         -------    ---------------�[0m
Some random text 345        True
Random some text 16         False
Text random some 1073741824 True

This issue appears in PScribo versions 0.9.1 and 0.10.0

Using the sample provided, I'm unable to duplicate this behavior. I ran the sample code on Server 2019 using both PowerShell Desktop 5.1 and PowerShell Core 7.3.1 with identical results.

CleanShot 2022-12-19 at 14 23 05

@tpcarman Can you please confirm?

That's weird (but good). I don't seem to have the issue anymore.