0

I have a bunch of pdf files in a folder on a Windows computer. One is named β-Alanine.pdf (note the beta character). When I programmatically (C# .NET WinForms) read the file names using folderInfo.EnumerateFiles(".pdf", SearchOption.TopDirectoryOnly)* and insert the file name in a varchar field of a SQL Server table, the file name gets changed to ß-Alanine.pdf (note the different beta character). Of course, when I subsequently read the file name from the DB and then use a method like File.Exists(filename) it fails. I'm at a loss here as to what to do to fix this other than asking people not to use Greek characters in the file name. Any suggestions are welcome.

Dalix
  • 33
  • 1
  • 6
  • 5
    Did you try to use NVARCHAR instead of VARCHAR ? – Sergey Nov 16 '21 at 12:39
  • Using NVARCHAR did the trick. Thank you so much! – Dalix Nov 16 '21 at 12:57
  • 1
    Does this answer your question? [What is the meaning of the prefix N in T-SQL statements and when should I use it?](https://stackoverflow.com/questions/10025032/what-is-the-meaning-of-the-prefix-n-in-t-sql-statements-and-when-should-i-use-it) – Charlieface Nov 16 '21 at 14:24
  • Your link provides useful information. Thanks. – Dalix Nov 16 '21 at 15:23

1 Answers1

0

Using NVARCHAR as suggested by Sergey resolved the problem.

Dalix
  • 33
  • 1
  • 6