Note that there are some explanatory texts on larger screens.

plurals
  1. POImport-Csv to get data that contains dash gives boxes or question mark
    text
    copied!<p>I have a very peculiar error when attempting to import some csv data. This data has links to files contained in a sharepoint site that need to stay the same. (I'm actually writing a script to delete these files). My problem is these links in particular have dashes in them which either powershell seems to not recognize or the import-csv command cannot handle. I also want to point out that there are two types of dashes. The hyphen is directly on your keyboard, these are the longer hyphens called "dashes" that are not directly on the keyboard.</p> <p>If you're not sure what I mean, open up MS Word and FULLY type out the following:</p> <pre><code>This - is a test. </code></pre> <p>You will notice that MS Word will auto convert the hyphen to a dash when you strike the space bar before typing the "a" and it will be longer.</p> <p>Please let me know how I can get powershell to recognize dashes!</p> <p>Examples:</p> <pre><code>$web.getListItem("link contains -") #finds file #Please note below the actual text is: link contains - $files = import-csv $path #csv is ms-dos csv $files[0].Url #Prints: link contains &lt;box&gt; $files = import-csv $path #csv is excel general csv $files[0].Url #Prints: link contains ? </code></pre> <p><strong>Solved</strong></p> <p>Figured this out. I used the following site to figure out the hex equivalent of my character and did a substitute in excel. <a href="http://www.asciitohex.com/" rel="nofollow">http://www.asciitohex.com/</a> Turned out the hex equivalent was: </p> <pre><code>e2 80 93 </code></pre> <p>or Url encode: </p> <pre><code>%E2%80%93 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload