Skip to content

Instantly share code, notes, and snippets.

@tiborepcek
Created June 18, 2018 13:26
Show Gist options
  • Save tiborepcek/72fa404be9a07ba8dc9422ead0b27537 to your computer and use it in GitHub Desktop.
Save tiborepcek/72fa404be9a07ba8dc9422ead0b27537 to your computer and use it in GitHub Desktop.
#NoTrayIcon
#include <Array.au3>
$fileCSV = @ScriptDir & "\test.csv"
$fileCSVinArray = FileReadToArray($fileCSV)
$fileCSVinString = _ArrayToString($fileCSVinArray, @CRLF)
$fileCSVinString = StringStripWS($fileCSVinString, 4) ;remove double (or more) spaces between words
#cs
List of dangerous characters and their safe alternatives:
' ' => '%20', '!' => '%21', '"' => '%22',
'#' => '%23', '$' => '%24', '%' => '%25',
'&' => '%26', '\'' => '%27', '(' => '%28',
')' => '%29', '*' => '%2A', '+' => '%2B',
',' => '%2C', '-' => '%2D', '.' => '%2E',
'/' => '%2F', ':' => '%3A', ';' => '%3B',
'<' => '%3C', '=' => '%3D', '>' => '%3E',
'?' => '%3F', '@' => '%40', '[' => '%5B',
'\\' => '%5C', ']' => '%5D', '^' => '%5E',
'_' => '%5F', '`' => '%60', '{' => '%7B',
'|' => '%7C', '}' => '%7D', '~' => '%7E',
#ce
Local $fromTo[9][2] = [["""", ""] _
, [@TAB, ""] _
, ["; ", ";"] _
, [" ;", ";"] _
, [" ", "%20"] _
, ["/", "%2F"] _
, ["\", "%27"] _
, ["+", "%2B"] _
, ["-", "%2D"]]
For $i = 0 to UBound($fromTo, 1) - 1 ;rows
For $j = 0 to UBound($fromTo, 2) - 1 ;columns
$fileCSVinString = StringReplace($fileCSVinString, $fromTo[$i][0], $fromTo[$i][1])
Next
Next
ClipPut($fileCSVinString) ;or FileWrite...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment