When I try to save:
7 test úüãáâàçéêíõóô áéíñóúü¿¡
.. to my database, it saves as:
7 test ������������� ���������
see row 24.
However as you can see in the DB, I'm able to store characters like this, see for 23, I manually updated this record.
I read:
ASP.NET-Saving Special Characters to Database
.. however I cannot htmlencode everything. Are they any other options here?
You need to work out where things are going wrong. For example, you might have all these steps to consider:
Is your schema set up correctly?
Are you receiving data correctly from the client?
Are you processing the data correctly?
Are you saving the data correctly?
Are you fetching the data correctly?
Are you serving the data correctly?
It's vital that you work out a way of diagnosing each step independently. Log the values at every point, in a way which you can prove can handle non-ASCII characters. Then you can see exactly where your data is being corrupted.
If it's not something within ASP.NET itself, I'd then suggest you create a short but complete console application which does nothing but try to save the data. You can then concentrate on getting that working with none of the friction you get through writing a web app... and you can also post that program here, so we can help you.
I am assuming that is either a VARCHAR or TEXT column? Try using NVARCHAR or NTEXT.
Related
I have been looking for a while now for a way to do this but nothing seems to be what I am looking for, but all I want is to enter in some data into a DataGridView, save it and then if I want, later load it back up. All the tutorial seem to focus on log in data from some database or something like that when all I want is a grid where I can put things in and add a search filter tool so I can look things up. It is for a project I am doing and I was wanting a way to save and organise data efficiently like how you can as if it was a text document but in a grid with a search filter as well as the way you can send file over to someone else who has the application and read the data. Sorry if I have put it in a confusing way.
I am doing this in Visual Studio 2019 in C#
You could use this one as a staring point. Although such approaches seem to be outdated. (Using datatables etc) Your best bet is using classes for serializing the data to json and sending the json file
i am working on c# win form project that stores name,phone No into XML file and display all data back to data grid view. File size is increasing day by day , I need this data multiple times on different forms, and parsing XML file every time is very costly. i would like to load XML file once and then use it where ever i need in my application but i do not know how can i perform this methodology in my project. Kindly guide me about best Approach for this problem.
Caching the parsed XML till it is needed is a solution to this.
Caching is a concept of storing the data in a Cache of the webserver for easy access if the data is being used multiple times, since querying the database each time would be laggy.
You can use the cached data instead of Querying the database each time you need something.
if you already have the XML parsed once, you can store it as a cached variable.
Look at this Question Here. It explains how exactly caching texhnique is used.
Hope this helps....
Thank you!
I am currently developing a Word-Completion application in C# and after getting the UI up and running, keyboard hooks set, and other things of that nature, I came to the realization that I need a WordList. The only issue is, I cant seem to find one with the appropriate information. I also don't want to spend an entire week formatting and gathering a WordList by hand.
The information I want is something like "TheWord, The definition, verb/etc."
So, it hit me. Why not download a basic word list with nothing but words(Already did this; there are about 109,523 words), write a program that iterates through every word, connects to the internet, retrieves the data(definition etc) from some arbitrary site, and creates XML data from said information. It could be 100% automated, and I would only have to wait for maybe an hour depending on my internet connection speed.
This however, brought me to a few questions.
How should I connect to a site to look up these words? << This my actual question.
How would I read this information from the website?
Would I piss off my ISP or the website for that matter?
Is this a really bad idea? Lol.
How do you guys think I should go about this?
EDIT
Someone noticed that Dictionary.com uses the word as a suffix in the url. This will make it easy to iterate through the word file. I also see that the webpage is stored in XHTML(Or maybe just HTML). Here is the source for the Word "Cat". http://pastebin.com/hjZj6AC1
For what you marked as your actual question - you just need to download the data from the website and find what you need.
A great tool for this is CsQuery which allows you to use jquery selectors.
You could do something like this:
var dom = CQ.CreateFromUrl("http://www.jquery.com");
string definition = dom.Select(".definitionDiv").Text();
I'm trying to pull some info off of a korean website and then make those korean characters usable and then put the info in a text file or the like. My idea was to create kind of a reference table (that would be done quickly, as there aren't too many sets of data that need that treatment, roughly 200).
My question is now,
first: if that is actually a solid idea or if there's a better or easier solution,
second: what format would I wanna use for such a table/sheet? csv, xml?
So far I'm getting the info via HtmlAgilityPacks XML/HTML stuff, which works quite well. Any help is appreciated, if you need any of my code, let me know so I'll edit it in.
.csv read slightly faster than .txt. But if only 200 characters, I think the difference is insignificant.
Have you considered using a resource file, normally used for exactly what you are doing and the appropriate translations will be loaded based on the default culture set on the users PC.
http://msdn.microsoft.com/en-us/library/y99d1cd3(v=vs.110).aspx
I am trying to build a Translation Assistant which can read in other compiled C# application (.exe), and display the forms from the EXE, are displayed individually, along with a table next to it with english column which will show the current english words on display, and another column for the value, which a translator can enter. Once completed translations, the translator can export the translations a resx file, to add to a project and also as an excel file for record purposes.
I am new to C# and hence am not sure if my strucute is correct, i have designed in such that a dll is inserted into the .exe during compilator, and then using this dll, the translation application can extract the string. This works for most strings, but it is getting stuck where there are several string that can apear in the same textbox at different times [e.g. disconnected, connected etc]. I have tried searching everywhere, but I am not able to find information on how i will be able to pull out all strings from an application, and be able to identify which form they belong to, in order to create my application?
the other issue i am faced with is, actually displaying the translated strings, the application i am building would benifit greatly if it could display a example of how the translated strings would look, as translations in some languages could be excessivly long. but i have found that i am only able to read in the aspects of the compiled applications and create an instance, but am not able to translate it.
I am reading in the exe using Reflection, and have understood from online that i need to use reflection.emit to modify the form. but i am finding every sting that is idenfitied from the form, is extracted as an instance, hence changing the string is only changing the instance of the strings , and not the instance of the form itself. hence i am not able so a correct display.
I have been trying for 3 weeks to solve these last two questions, Thanks in advance for helping me solve this.
I think you can't find a general solution to your problem with the texts that may appear in the textbox. Here is why:
If the texts are in the resource file, you could read them, but you still don't know where they are used. You would need to do a complex analysis of the source code to know, where the text is displayed. Just imagine this little scenario:
textBox.Text = GetCorrectText(connection.State);
GetCorrectText could look like this:
string GetCorrectText(ConnectionState state)
{
return string.Format(Resources.ConnectionState, state);
}
Resources.ConnectionState might be "The connection is in the state {0}".
Its a simple example, but you would need to know or extract a lot of things:
The text property of the TextBox class is the string that is shown to the user
The Method GetCorrectText returns the text, so you need to parse it.
The Method string.Format returns the text. Now you either would need to hardcode that for string.Format it should use the first parameter as the text that is displayed or you would have to parse string.Format to learn that fact.
The example shows something else: You wouldn't be able to translate the whole string that is being displayed, because part of it is the name of the enum value.
What I want to show you is that you need to make trade offs.