Creating data URLs with PowerShell
PS> add-type -assemblyName System.Web
PS> $dataUrl = 'data:,' + [System.Web.HttpUtility]::UrlEncode("Rene says:`nHello World!")
PS> start-process chrome $dataUrl
Making sure that the right
encoding is specified (Note the acute accent on
René):
PS> $dataUrl = 'data:text/plain;charset=UTF-8,' + [System.Web.HttpUtility]::UrlEncode("René says:`nHello World!")
PS> start-process chrome $dataUrl
Using
Base64, for example to decode an image:
PS> $pngBase64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes('C:\Windows\System32\@WLOGO_48x48.png'))
PS> $dataUrl = 'data:image/png;base64,' + $pngBase64
PS> start-process chrome $dataUrl
PS> start-process chrome 'data:text/html,<html%20contenteditable>'