Solved

Asp.net and Postgresql

Posted on 2009-05-15
8
723 Views
Last Modified: 2013-11-08
I have an asp.net 3.5 app using a postgresql database with sql_ascii encoding.  How do I configure my app to show strings with accentuation from DB?

After searching for a solution, I found that the encoding used by postgresql is always unicode (connection string = Server={0}; Port={1}; database={2}; Userid={3}; password={4}; Pooling=false; Timeout=20; Encoding=UNICODE",). If you use ASCII, it's ignored.

At the head section of my aspx page, I tried using
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

I inserted
    <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" culture="pt-BR"/>
at my web.config file. I also tried
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="pt-BR"/>

None of this solved my problem. the accentuated character are shown as square characters.
0
Comment
Question by:jeovaalmeida
  • 4
  • 4
8 Comments
 
LVL 61

Expert Comment

by:gheist
Comment Utility
And what is symbol under square character?
Do you use custom font without sheriff / sans sheriff fallback?
Does this show up correctly :http://en.wikipedia.org/wiki/Portuguese_alphabet ?
0
 

Author Comment

by:jeovaalmeida
Comment Utility
The characters shown as square (as big as lowercase characters) are those accentuated characters, at http://en.wikipedia.org/wiki/Portuguese_alphabet, at the line (3rd) that starts with "In addition, the following characters with diacritics are used " ...
The font used by my website is tahoma.
 >> Does this show up correctly :http://en.wikipedia.org/wiki/Portuguese_alphabet ?
I'm not sure if I understood your question correcty, but if you want to know if the characters of that page shows up correctly, the answer is yes.
0
 
LVL 61

Expert Comment

by:gheist
Comment Utility
You have to install support for your region from windows to get characters displayed correctly in all fonts.
0
 

Author Comment

by:jeovaalmeida
Comment Utility
And how do I do that?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 61

Expert Comment

by:gheist
Comment Utility
CYou can have look at page source in your browser - do you get correct characters and encodings from server. Sometimes it is wrong server encoding header you never paid attention to.
0
 

Author Comment

by:jeovaalmeida
Comment Utility
I clicked View >> Source Code. The HTML shows the squares, too.
Firefox has the "iso-8859-1" as an option for encoding option (View >> Encoding) . But even selecting this option the right characters aren't shown. (though the square character is changed by other strange one).
0
 
LVL 61

Expert Comment

by:gheist
Comment Utility
So ASPnet gives squares.
0
 

Accepted Solution

by:
jeovaalmeida earned 0 total points
Comment Utility
I found a solution: using the built in postgre database function
convert(fiedlName using windows_1250_to_utf8)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 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