Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

[C#][Samples/Templates] Add UTF8 default encoding for deployment scripts #2289

Merged
merged 1 commit into from
Sep 9, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if ($outputs)
# Update appsettings.json
Write-Host "> Updating appsettings.json ..."
if (Test-Path $(Join-Path $projDir appsettings.json)) {
$settings = Get-Content $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
$settings = Get-Content -Encoding utf8 $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
Expand All @@ -196,7 +196,7 @@ if ($outputs)
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword
foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $projDir appsettings.json)

if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,4 @@ foreach ($language in $languageArr)
}

# Write out config to file
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder "cognitivemodels.json" )
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $outFolder "cognitivemodels.json" )
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else {

Write-Host "> Getting config file ..."
$languageMap = @{ }
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
$config = Get-Content -Encoding utf8 -Raw -Path $configFile | ConvertFrom-Json
$config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.Name] = $_.Value }

foreach ($langCode in $languageMap.Keys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if ($outputs)
# Update appsettings.json
Write-Host "> Updating appsettings.json ..."
if (Test-Path $(Join-Path $projDir appsettings.json)) {
$settings = Get-Content $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
$settings = Get-Content -Encoding utf8 $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
Expand All @@ -196,7 +196,7 @@ if ($outputs)
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword
foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $projDir appsettings.json)

if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,4 @@ foreach ($language in $languageArr)
}

# Write out config to file
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder "cognitivemodels.json" )
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $outFolder "cognitivemodels.json" )
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else {

Write-Host "> Getting config file ..."
$languageMap = @{ }
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
$config = Get-Content -Encoding utf8 -Raw -Path $configFile | ConvertFrom-Json
$config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.Name] = $_.Value }

foreach ($langCode in $languageMap.Keys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if ($outputs)
# Update appsettings.json
Write-Host "> Updating appsettings.json ..."
if (Test-Path $(Join-Path $projDir appsettings.json)) {
$settings = Get-Content $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
$settings = Get-Content -Encoding utf8 $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
Expand All @@ -196,7 +196,7 @@ if ($outputs)
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword
foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $projDir appsettings.json)

if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,4 @@ foreach ($language in $languageArr)
}

# Write out config to file
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder "cognitivemodels.json" )
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $outFolder "cognitivemodels.json" )
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else {

Write-Host "> Getting config file ..."
$languageMap = @{ }
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
$config = Get-Content -Encoding utf8 -Raw -Path $configFile | ConvertFrom-Json
$config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.Name] = $_.Value }

foreach ($langCode in $languageMap.Keys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if ($outputs)
# Update appsettings.json
Write-Host "> Updating appsettings.json ..."
if (Test-Path $(Join-Path $projDir appsettings.json)) {
$settings = Get-Content $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
$settings = Get-Content -Encoding utf8 $(Join-Path $projDir appsettings.json) | ConvertFrom-Json
}
else {
$settings = New-Object PSObject
Expand All @@ -196,7 +196,7 @@ if ($outputs)
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword
foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $projDir appsettings.json)

if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,4 @@ foreach ($language in $languageArr)
}

# Write out config to file
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $outFolder "cognitivemodels.json" )
$settings | ConvertTo-Json -depth 100 | Out-File -Encoding utf8 $(Join-Path $outFolder "cognitivemodels.json" )
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else {

Write-Host "> Getting config file ..."
$languageMap = @{ }
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
$config = Get-Content -Encoding utf8 -Raw -Path $configFile | ConvertFrom-Json
$config.cognitiveModels.PSObject.Properties | Foreach-Object { $languageMap[$_.Name] = $_.Value }

foreach ($langCode in $languageMap.Keys) {
Expand Down