replace MSWord smart quotes in asp.net webform

前端 未结 3 671
醉话见心
醉话见心 2021-01-29 00:28

I am having a problem where users are composing some large chunks of text in MS Word, then pasting that in to the online form. These get entered into the DB as an upside down ?

3条回答
  •  执笔经年
    2021-01-29 00:47

    What are my options to replace these with standard quotes?

    The best approach is not to replace them. People want to use “smart quotes”, let them. They're not aberrations that only exist in MS Word, they're perfectly valid Unicode characters, and if your application isn't storing non-ASCII characters right then there's a whole lot more that will go wrong than just smart quotes.

    Use UTF-8 encoding for all your web pages and store your content in a Unicode-capable database (eg. if you are using SQL Server, use NVARCHAR) and you'll not only support smart quotes but also accents and other alphabets.

提交回复
热议问题