Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing of enclosing quotes & Missing encoding #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PSIni/Functions/Get-IniContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

$commentRegex = "^\s*([$($CommentChar -join '')].*)$"
$sectionRegex = "^\s*\[(.+)\]\s*$"
$keyRegex = "^\s*(.+?)\s*=\s*(['`"]?)(.*)\2\s*$"
$keyRegex = "^\s*(.+?)\s*=\s*((['`"]*).*\3)\s*$"

Write-Debug ("commentRegex is {0}." -f $commentRegex)
}
Expand Down Expand Up @@ -141,7 +141,7 @@
$section = $script:NoSection
$ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)
}
$name, $value = $matches[1, 3]
$name, $value = $matches[1, 2]
Write-Verbose "$($MyInvocation.MyCommand.Name):: Adding key $name with value: $value"
if (-not $ini[$section][$name]) {
$ini[$section][$name] = $value
Expand Down
4 changes: 2 additions & 2 deletions PSIni/Functions/Out-IniFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Function Out-IniFile {
# -- Unicode: Encodes in UTF-16 format using the little-endian byte order.
# -- UTF7: Encodes in UTF-7 format.
# -- UTF8: Encodes in UTF-8 format.
[ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String")]
[ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String", "Default")]
[Parameter()]
[String]
$Encoding = "UTF8",
Expand Down Expand Up @@ -123,7 +123,7 @@ Function Out-IniFile {
[System.Collections.IDictionary]
$InputObject,

[ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String")]
[ValidateSet("Unicode", "UTF7", "UTF8", "ASCII", "BigEndianUnicode", "Byte", "String", "Default")]
[Parameter( Mandatory )]
[string]
$Encoding = "UTF8",
Expand Down