Xah Talk Show 2022-01-11 speed comparison find/replace python, perl, PowerShell, elisp, golang, WolframLang

Xah Talk Show 2022-01-11 speed comparison find/replace python, perl, PowerShell, elisp, golang, WolframLang
(xah-find-text
"commands"
"c:/Users/xah/web/xahlee_info/xx/"
"\\.html$"
nil
t)

python error

2022-01-11 12:46:26.537966
3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
Input Dir: c:\Users\xah\web\xahlee_info\xx
Find string:
commands
Replace string:
commands

*  1   c:/Users/xah/web/xahlee_info/xx/elisp/Active-Keymaps.html
Traceback (most recent call last):
  File "c:\Users\xah\git\xah_find_replace\replace.py3", line 111, in <module>
    replace_string_in_file(dirPath + os.sep + fName)
  File "c:\Users\xah\git\xah_find_replace\replace.py3", line 83, in replace_string_in_file
    output_file.write(file_content)
  File "C:\Python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u21d2' in position 6892: character maps to <undefined>

 ’’’’’⇒ 
# xah-find-replace accept a piped file object, it'll do find/relpace a  line ending to unix convention
# sample use:
# dir -Recurse -file -Include "*html" | xah-newline-to-unix
# 2021-12-16

function xah-find-replace {
Process {
$content = [IO.File]::ReadAllText($_)
if ($content.contains("`r`n")) {
Copy-Item $_ ($_.fullname+(Get-Date -Format "~yyyyMMddHHmm~"))
$newContent = ($content -replace "`r`n", "`n")
[IO.File]::WriteAllText($_, $newContent)
}
elseif ($content.contains("`r")) {
Copy-Item $_ ($_.fullname+(Get-Date -Format "~yyyyMMddHHmm~"))
$newContent = ($content -replace "`r", "`n")
[IO.File]::WriteAllText($_,  $newContent)
} } }

xah_talk_show_2022-01-11.txt