Force textify.ps1 to read files as UTF-8.
Prior to the switch from AsciiDoc to Asciidoctor we converted release_notes.html to NEWS using elinks or lynx, which in turn generated ASCII output. It was sufficient to read NEWS in PowerShell using Get-Content, which defaults to ASCII. We now use tools/html2text.py, which generates UTF-8. Switch Get-Content's encoding to match. Note that Notepad detects file encodings heuristically, and that we might want to use a BOM. Bug: 14636 Change-Id: Ibd92ef7ad642631a938bb4d75a2d83f479099032 Reviewed-on: https://code.wireshark.org/review/27240 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
15f1b0b5e4
commit
cd94b1cb8e
|
@ -71,7 +71,13 @@ foreach ($src_file in Get-ChildItem $SourceFiles) {
|
|||
$src_modtime = (Get-Item $src_file).LastWriteTime
|
||||
|
||||
if (-not (Test-Path $dst_file) -or ((Get-Item $dst_file).LastWriteTime -lt $src_modtime)) {
|
||||
$contents = Get-Content $src_file
|
||||
# "Get-Content -Encoding" is undocumented in PS 2.0, but works
|
||||
# here. If it doesn't work elsewhere we can use:
|
||||
# $contents = [System.IO.File]::ReadAllLines($src_file, $no_bom_encoding)
|
||||
$contents = Get-Content -Encoding UTF8 $src_file
|
||||
# We might want to write this out with a BOM in order to improve
|
||||
# the chances of Notepad's UTF-8 heuristics.
|
||||
# https://blogs.msdn.microsoft.com/oldnewthing/20070417-00/?p=27223
|
||||
[System.IO.File]::WriteAllLines($dst_file, $contents, $no_bom_encoding)
|
||||
Write-Host "Textified $src_file to $dst_file"
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue