Solved

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

Posted on 2008-10-06
4
226 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.net show message while code is running 3 17
How to join on ID, with prefix? 15 58
performance issue in asp web 5 28
jquery datatables, asp.net MVC 9 39
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

16 Experts available now in Live!

Get 1:1 Help Now