You are here: Re: Escaping international (unicode) characters in string « MsSQL Server « IT news, forums, messages
Re: Escaping international (unicode) characters in string

Posted by Greg R. Broderick on 05/29/07 17:01

Erland Sommarskog <esquel@sommarskog.se> wrote in
news:Xns993F9F38ABD05Yazorman@127.0.0.1:

> Greg R. Broderick (usenet200705@blackholio.dyndns.org) writes:
>> I am needing some way, in the SQL Server dialect of SQL, to escape
>> unicode code points that are embedded within an nvarchar string in a
>> SQL script, e.g. in Java I can do:
>>
>> String str = "This is a\u1245 test.";
>
> SELECT @str = 'This is a' + nchar(1245) + ' test'
>
> Note here that 1245 is decimal. If you want to use hex code (which you
> normally do with Unicode), you would do:
>
> SELECT @str = 'This is a' + nchar(0x1245) + ' test'

When there are more than one or two non-US-ASCII characters in the string,
this quickly becomes impractically unwieldy, thus my comment in my original
posting:

--- quote ---

I am already aware of the UNISTR() function, and the NCHAR() function, but
those aren't going to work well if there are more than a few international
characters embedded within a string.

--- quote ---

Thanks anyway, though. :-)

--
---------------------------------------------------------------------
Greg R. Broderick usenet200705@blackholio.dyndns.org

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация