Solved

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

Posted on 2008-10-06
4
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

707 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