I have table written to by an application. The field is varchar(max). The data looks like xml.
DECLARE @poit VARCHAR(100)
SET @poit = \'
I would try changing the datatype of your @poit
variable from VARCHAR(100)
to NVARCHAR(100)
. Then replace the utf-8 encoding with utf-16 so your code would look something like:
DECLARE @poit NVARCHAR(100)
SET @poit = 'VÍA '
SELECT CONVERT(XML,REPLACE(@poit, 'utf-8', 'utf-16'))
As long as you're not calling the conversion with the replace in it in a SELECT that returns oodles of results, the performance should be just fine and it will get the job done.
Reference: http://xml.silmaril.ie/characters.html <- scroll down and you'll see some info as to the difference between utf-8 & utf-16. Hope this helps!