Solved

How do I save and read umlaut characters with DetailsView in Visual Studio?

Posted on 2008-10-06
4
222 Views
Last Modified: 2013-11-26
I'm fairly new to developing in Visual Studio and have run into a problem using DetailsView writing text to SQL Server 2005.

When editing text and saving, characters like ö (o with umlaut) are changed. The character ö becomes ö in the database and when read back into DetailsView.

If I use SQL Server Management Studio to write the character into the database field it is not changed, i.e. it is correct also when read into the DetailsView control. My problem only occurs when saving from the DetailsView control.

I'm sure there's a simple solution to this but I'm stuck, so any help would be greatly appreciated. Thanks!
0
Comment
Question by:MikaelNystrom
  • 2
  • 2
4 Comments
 
LVL 25

Assisted Solution

by:Luis Pérez
Luis Pérez earned 500 total points
ID: 22648027
Mmmm... I guess that the problem is about the encoding that you are using for you web site. Check the globalization setting in your web.config; it's located inside the system.web element. Check that looks like this (or change if not):

<configuration>
    <system.web>
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="en-US"/>

Of course, replace "en-US" with your correct culture if you're not located in United States.

Then, try again to save the data to your database.

Hope that helps.
0
 

Author Comment

by:MikaelNystrom
ID: 22648154
Thanks for the suggestion. I added:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="sv-SE" uiCulture="sv-SE"/>

Sorry to say, it didn't help...
0
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 22648313
Can you post the source code of the page that contains the DetailsView control? Not the source code page from Visual Studio, but the source code of the page once it's rendered to internet browser (in IE it's obtained by going to View -> Source code menu option).
0
 

Accepted Solution

by:
MikaelNystrom earned 0 total points
ID: 22648434
I got it to work! Turns out that to save utf-8 in SQL Server I have to use nvarchar (I was using nchar).

Many thanks for your suggestion. I actually didn't have the globalization setting in web.config, so that was a useful thing to add anyway.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now