How to read hidden characters with c#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maker2254
    New Member
    • Sep 2006
    • 1

    #1

    How to read hidden characters with c#?

    I have a text file which I attached in this post.I read this file using StreamReader in c# and insert into SQL. When I try to insert the data,I get error.I was trying to find the problem for that i tried removing the text word by word from the text file and trying the code again.Finally I found the problematic part , removed it and successfully inserted into SQL . When I copy the text and paste into notepad ,there is nothing I could observe. . After spending some time I decided putting into word. I copied the text and paste into word 2007 and found the problem.The problematic text has hidden characters in it. The character is "--" . Two hyphens or dashes. According to my research , SQL database does not accept this Character sequence against SQL injection .After finding the issue, I tried to fix it. What I tried is , read the text file and if i see that sequence replace with new characters . I tried stream reader to read the text file but i can not find the hidden characters with stream reader . what is the best way to read hidden characters with c# .
    I attached the file if you open in word you see the characters also in notepad++ . But not in notepad
    Attached Files
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I see the record seperator character 0x1E twice in a row right before the word Fax
    Look for that character, not the - character?

    Comment

    Working...