C# - Renders String With Wrong Encoding, But PHP Doesn't (SQL)?

May 20, 2010

I took over some old php application with MySQL as database. Inside the database, there are tables including content with localized strings (therefore containing special chars)Currently there is a PHP application accessing that database. My job is to create an ASP.net (C# codebehind) application that accesses that strings as well. That works, as far as encoding goes.If I try to access these strings, I do get a kind of encoding problem, like 'Ändern' and 'Prüfzeichen', but only in the ASP.net application. The PHP app sets utf-8 as charset and the strings are perfectly rendered. In the ASP.net application it's gibberish, regardless of the page encoding.In the MySQL database, the charset for the specified table 'translations' is set to 'latin --cp1252 West European' and collation to 'latin_swedish_ci'.I can't seem to figure out what PHP apparently does, and ASP.net does not. I traced the php code and could not find any sign of special encoding while getting a string from the database.The question is, how can I ensure correct encoding inside the ASP.net application without modifying the database, because big changes at the php code are not possible?

View 3 Replies


Similar Messages:

Web Forms :: Wrong Encoding While Exporting Gridview To Excel?

Jul 30, 2010

In my application i have gridview that I export it to excel. When exporting I have the option to select if show the data with images or with no images. The application run well, but when i try export Hebrew data I got gibberish letters. The second thing is that if I select the option "with no images"

Sometimes the Hebrew seems good, and sometime not. Of course I add the Response.ContentEncoding. I thing maybe I should encoding one of this rows

[Code]....

But don't know how. Here is my application printscreen. and this is my code

[Code]....

View 2 Replies

Can Renders All The Content Sections Of The String

Mar 21, 2011

Does the RenderSection(string contentName, bool isRequired) method renders all the content sections mentioned in the method?
<div data-role="content">
@RenderSection("ContentSection", true)
</div>

so, does all the ContentSectionin all the cshtml files are rendered automatically?

View 1 Replies

MVC - Html Helper That Renders An Action To As A String

Nov 23, 2010

I need an Html Helper that renders an action to as a string.

View 1 Replies

State Management :: Data Being Saved To Wrong Table In Wrong Instance Of Sqlserver Of Wrong Database?

Aug 1, 2010

I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?

View 7 Replies

Webmailer Encoding Characters / Set The Content Encoding Of The Whole Page?

Jan 4, 2010

I have written a web mailer that can send and receive emails and display them on a webpage.I have a problem displaying special characters though. Like Russian, and Greek and chinese.I am using openpop.net and I can get the encoding of the incoming email as one of my variables.Thing is, how do I display it? Do I set the content encoding of the whole page to what that specific email encoding is?I've got it UTF-8 at the moment and I get garbage.

View 3 Replies

MVC :: Encoding Whitespace / Not Encoding The < As A Encode But Into The Form <?

Jan 5, 2010

Im pulling out a text field from the database which has and 's in it for line breaks. Which I have left there for pupose of being able to edit the fields later on.

So when i try to display the text I need to replace them which I have done with:

[Code]....

Simple enough. Only when I run the page the source code I get for it is:

<br />

So it seems its not encoding the < as a encode but into the form <

Does anyone know how to stop this happen. Or a method around it?

View 3 Replies

Unclosed Quotation Mark After The Character String - What's Wrong With This MSSQL Query

Dec 30, 2010

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True")
Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT * FROM Table1 WHERE Date =" & TextBox1.Text & "'", SQLData)
SQLData.Open()
Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader()
While dtrReader.Read()
For j As Integer = 1 To 31
Dim s As String = "s" & j
If dtrReader(s.ToString()).ToString() = "b" Then
Dim img As ImageButton = DirectCast(Panel1.FindControl(s.ToString()), ImageButton)
img.ImageUrl = "~/Images/booked.gif"
img.Enabled = False
End If
Next
End While
dtrReader.Close()
SQLData.Close()
End Sub

Error:

Unclosed quotation mark after the character string ''.

View 3 Replies

Web Forms :: Encrypted String Doesn't Match With Targeted String?

Feb 23, 2011

i have created a encrypted string to match with a target string to pass it along with client URL for authentication. it doesn't match. here is an algorithm used to create a encrypted string.

text = "astringtobeencrypted";
string strglobalkey = "mytestglobalkey";
string hexivkey = "testing12345";
ebCryptLib.eb_c_Cipher ci = new ebCryptLib.eb_c_Cipher();
string strhex1 = ConvertStringToHex(strglobalkey);
string strhex2 = ConvertStringToHex(hexivkey);
byte[] bytes = (byte[])ci.EncryptStringRaw(EB_CRYPT_CIPHER_ALGORITHM.EB_CRYPT_CIPHER_ALGORITHM_DES3_ECB,
strhex1, strhex2, text);
return Convert.ToBase64String(bytes);

the above alogithm returns a string which doesn't match with our targetted string provided by the client.

what should i do to match with the targetted string? The client had generated the encrypted string using PHP.

View 3 Replies

Forms Data Controls :: Gridview Row_databound Calculation Error - Input String In Wrong Format?

Dec 7, 2010

I have a gridview in which i have itemtemplates and label controls having data from sql server.

I have two fields say quantity and units and in third field i want their product. I m trying in rowdatabound event like this-

[Code]....

Here my third field is netvalue.

It is throwing error-

Input string in wrong format.

How can i achieve this?

View 5 Replies

ADO.NET :: Data Saving To Wrong Database On Wrong Instance Of Sqlserver

Aug 1, 2010

I have a very weird thing happening. I have two databases that have exactly the same tables but different database names on the same virtual machine, but in different instances of SQL Server. For some reason, when using one of them, it will save to the other. In debug, looking at my connection string..I have verified that it is correct, yet when I allow the save, I look in the table and it isn't there, it is in the other database that is in a table with a completely different name and in a different instance of SQL Server.

View 1 Replies

Web Forms :: String Manipulation With C#.net Doesn't Work

Aug 21, 2010

I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work! I've a character 'A' in the string and i'm unable to replace it with a space ! stringvalue.Replace(A, " ");

View 5 Replies

Configuration :: Application Doesn't Read String From Web.config File

Sep 8, 2010

I am trying to read a normal string from the web.config file. When I try to read a string from the web.config file the application doesnt seem to read it. I set my sqlconnection string in the web.config file. It reads a sqlconnection string but not a normal string.Here is my code:

web.config file:
<applicationSettings>
<MyApplication.Settings>
<setting name="Colour" serializeAs="String">
<value> "Red"</value>
</setting>
</MyApplication.Settings>
</applicationSettings

This is how I try to call the setting:

string strColour = Properties.Settings.Default.Colour;

I am using .net framework 4.0

View 2 Replies

Membership Role Provider Doesn't Work With Custom Connection String

Oct 18, 2010

I have Membership configured with IIS7, tables for it located in my own database, created with aspnet_regsql utility, and I am using custom connection string to access it.

This is part of web.config related to Membership :

[code]...

View 2 Replies

C# - Html.CheckBox Renders Two Checkboxes?

Mar 29, 2011

When I try to serialize <%: Html.CheckBox("Something", true) %> in jquery (using form.serialize()) I get two checkboxes, one says true, and the other false. I am aware that MVC renders true, false for checkboxes that are true, so if I wasn't coming through javascript, I'd just check for the presence of true, but how do I know if my checkbox is checked after doing form.serialize?

View 2 Replies

Build Proxy Site That Renders Any URL?

Sep 27, 2010

I want to build a proxy site that renders any URL. Given an url, I need to replace all html links, css links and js urls from href="/original.htm" to [URL] sort of. How can I do? is there a ready-to-use framework? I use ASP.NET and C#.

View 1 Replies

Validation Summary Text Renders Black?

Jun 7, 2010

<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="CreateUserWizard1" ForeColor="red"...

why does the text render black when I have the ForeColor set to red.

If I change the displaymode to List it renders red, but in BulletList and default it's black.

View 5 Replies

MVC :: (RC2) - Partial View Renders A Drop Down Box With Several Values

Dec 15, 2010

have a view which invokes partial view. I am having trouble getting to updated values in model used in partial view on the post back. Here is the razor code for my main view:

[Code]....

The partial view renders a drop down box with several values. The Razor code for this partial view is shown below:

[Code]....

The controller action method to get the page is shown below:

[Code]....

When user changes the dropdown option to something else and clicks on submit button, my service side controller method is invoked. The example code is shown below:

[Code]....

This issue is that thisModel.MyInnerModel.MyOption does not have user selected value. If I do away with partial view and keep all Razor code in the main view, every thing works as expected and I can see the changed value in thisModel.MyInnerModel.MyOption property.

View 3 Replies

ITextSharp Renders Image With Poor Quality In PDF

Mar 26, 2010

I'm using iTextSharp to print a PDF document. Everything goes ok until I have to print the company logo in it.

First I noticed that the logo had poor quality, but after testing with several images, I realize that was the iTextSharp rendering it poorly.The test I did to say this was to print the PDF using my code and then edit the document with Acrobat 8.0 and I drew an image. Then printed the two documents and saw the noticeable difference.My question is that if anyone know if this can be due to a scaling problem where I'm failing to tell iTextSharp how it must render the image or is an iTextSharp limitation.

The code to render the image is the following:

[Code]....

The method ResizeImage() do the resizing of the width and height respecting the aspect ratio and keeping in a max width and a max height limits.

View 2 Replies

MVC :: Tables And FormCollection - Renders Data Out To A Form ?

Apr 19, 2010

I have a basic form that renders data out to a form like so (from Northwind):

<% using (Html.BeginForm())
{ %>
<h2>Region Selection</h2> [code]....

In addition, I have a controller that is called when the form is posted back:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(FormCollection collection)
{ [code]...

The problem is that none of the data in the table is being captured in the FormCollection in the Post. The TextBoxes pass data as expected so I know the wireup is working.I read from some other posts that you need a value for the name property - but that did not work. Also, I read that you need to put the data inside a TextBox inside the TD. Instead of grasping at straws, does anyone know the best pattern to pass the data from a Table back into the FormCollection?

btw: I tried to copy/paste formatted test in from Word. No dice. Ugh.

View 4 Replies

AJAX :: Table In ContenTemplate Renders Outside Of TabPanel?

Oct 12, 2010

I have a TabContainer with 3 TabPanels. The container has a yellow background. On the first tab the yellow background is the height of all the controls. On tab 2 and tab 3 I just get a strip of yellow and then below that is my table of controls. The controls are outside of the TabPanel border. I checked the code and my table on each tab is between the <ContentTemplate> tags. This was not doing this before. This app is VS 2005 with Ajax Version=1.0.61025.0 All I have changed is installing VS 2010. I even took an old backup and it's still doing the strip of yellow on tab 2 and tab 3. Here is my stylesheet:

/* default layout */
.ajax__tab_default .ajax__tab_header {white-space:nowrap;}
.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-

[Code]....

View 1 Replies

C# - Can Control The Order In Which The TagBuilder Class Renders Attributes?

Aug 12, 2010

I know this is kind of obsessive, but is there a way to control the order that the TagBuilder class renders the attributes of an HTML tag when you call ToString()?

i.e. so that

var tb = new TagBuilder("meta");
tb.Attributes.Add("http-equiv", "Content-Type");
tb.Attributes.Add("content", "text/html; charset=utf-8");
tb.ToString(TagRenderMode.SelfClosing)

will return

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

not

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

Changing the order that you add the attributes doesn't change it, it seems to be rendering in alphabetical order

View 2 Replies

Web Forms :: How To Find Out What HTML Does Each Server Control Renders

Mar 7, 2011

I try to run each control and then check what html did it render.

But this seems to me as an inaccurate method as whenever we add or remove the properties, or events of the control,the rendered HTML changes. Is there any book/tutorial/article to explain what is the standard HTML rendered by each asp.net control.

View 3 Replies

Gridview - What Property Exists To Find Out If The Grid Renders Or Not

Nov 17, 2010

When there is no DataSource assigned to my grid it doesn't render which is great!

When the datasource is empty it doesn't render - also great :-)

I am implementing some custom navigation so i want to know if there is a property that tells me if the dataview is rendered? If it is rendered i can show my custom bits otherwise i don't.

View 2 Replies

Web Forms :: Menu Renders Vertically Briefly Then Horizontally

Jul 20, 2010

The menu control when used on the newly released VS2010 with ASP.Net version 4.0 renders vertically briefly, then renders horizontally. This causes a 1/2 second annoying flash of the menu in vertical form before it disappears and renders horizontally as intended. If you choose to render the menu as a table this problem doesn't happen, but if you choose to render the menu as a list (using <ul><li>) then if happens every time, but is hidden on development systems where response is quick enough such that the rendering vertically is not visible to the naked eye. How can I cause the rendering to be horizontal (without the brief vertical rendering)?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved