Re: Obtain Unicode value from Character Code?
From: Craig Wagner (craig_d_wagner_at_hotmail.com)
Date: 09/10/04
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: types and untyped dataset and access the right column"
- Previous message: nabil m: "types and untyped dataset and access the right column"
- In reply to: Jon Skeet [C# MVP]: "Re: Obtain Unicode value from Character Code?"
- Next in thread: Craig Wagner: "Re: Obtain Unicode value from Character Code?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Sep 2004 08:53:58 -0700
Jon Skeet [C# MVP] <skeet@pobox.com> wrote:
>> >However, the database really ought to be able to know how it's stored
>> >them and give you the text in Unicode. What's the type of the column,
>> >what's the database in question, and how are you retrieving the
>> >database?
>>
>> The database has stored the value as an integer. The database isn't storing the
>> character, it's storing the character code (i.e. it's not storing the smart
>> quote, it's storing 147 as an integer).
>>
>> The database is SQL Server 2000 and my C# code is calling a stored proc that is
>> used to populate a DataTable.
>
>So it's storing a character as the integer value in an ill-defined
>encoding? That doesn't sound like a terribly good idea, to be honest.
We also have the font set to use to represent the character. This information is
being used to create a Word document using WordML.
It ain't my design, but it has been working pretty well until we went to
implement this new feature.
>Anyway, Encoding.Default *might* do what you want it to, as I said
>before - just put the integer value into a byte array as the sole
>value, and call Encoding.GetString to get the appropriate string. If
>the encoding is subtly different though, you'll have problems.
I'll give it a shot. Thanks.
--- Craig Wagner, craig.wagner(at)comcast.net Portland, OR "Don't ban high-performance vehicles, ban low-performance drivers!"
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: types and untyped dataset and access the right column"
- Previous message: nabil m: "types and untyped dataset and access the right column"
- In reply to: Jon Skeet [C# MVP]: "Re: Obtain Unicode value from Character Code?"
- Next in thread: Craig Wagner: "Re: Obtain Unicode value from Character Code?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|