2

How can I send Unicode symbols using SQL Server Database Mail? My goal is to send a symbol on the subject of an email. Let's say that, for example, I want to send this "🚯 Subject with symbol" on the subject. The symbol I want to use come from Segoe UI Emoji font.

Thanks!

closed as off-topic by Michael Green, Md Haidar Ali Khan, Andriy M, MDCCL, Mr.Brownstone Oct 24 '18 at 17:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Michael Green, Md Haidar Ali Khan, Andriy M, MDCCL, Mr.Brownstone
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you try @subject = N'🚯';? I didn't follow this all the way through (I don't have a local system with database mail enabled) but the big thing that trips people up when dealing with Unicode characters is the simple N prefix. See this example. – Aaron Bertrand Oct 23 '18 at 20:24
  • Thank to your suggestion is working now. I was sending the value to a store procedure with the N but I have the parameter with varchar DECLARE "@Subject varchar(50)" once I changed to DECLARE "@Subject nvarchar(50)" works, Thanks! – Albert Torres Oct 23 '18 at 20:47
  • What is that make this question "Too localized"? – Albert Torres Oct 25 '18 at 16:01
  • I did not vote but a lot of people use that reason for minor typos and simple issues that won't help a lot of people. You want to use Unicode characters but you chose varchar, that's probably the last time you'll do that. :-) – Aaron Bertrand Oct 25 '18 at 16:02
4

Make sure you always use nvarchar as the data type throughout the whole flow, and always prefix Unicode strings with N. There is a big difference:

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.