Datagridview displaying garbage characters
-
Open up note pad, hold the left control and press backspace. You will produce a rectangle box character which i am not sure if it has any function or not in the operating system but when i pull data from my database, these characters appear where i believe are to be carriage returns. is there a way to parse/seperate those garbage characters out while still leaving them in the database? If the data is bound to a richtextbox control, the text appears formated with carriage returns correctly im stuck...
-
Open up note pad, hold the left control and press backspace. You will produce a rectangle box character which i am not sure if it has any function or not in the operating system but when i pull data from my database, these characters appear where i believe are to be carriage returns. is there a way to parse/seperate those garbage characters out while still leaving them in the database? If the data is bound to a richtextbox control, the text appears formated with carriage returns correctly im stuck...
is it possible that the data is Unicode and you're treating it as normal ascii, or vise versa? i've accidently set varchar columns in the db to use nvarchar and it did some wierd things until i changed it back. they could also be special formatting characters that work in rich text, but a singleline textbox cant show them.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
is it possible that the data is Unicode and you're treating it as normal ascii, or vise versa? i've accidently set varchar columns in the db to use nvarchar and it did some wierd things until i changed it back. they could also be special formatting characters that work in rich text, but a singleline textbox cant show them.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
The entire database, every table uses varchar not nvarchar. I've had issues in the past with nvarchar too plus it takes more space and computing power plus it is pretty much an all english environment thus no real need for nvarchar. i think you are right with the special formatting not working in a regular textbox/data grid view. I wonder if there is away around that though to ignore which ever charaters.
-
The entire database, every table uses varchar not nvarchar. I've had issues in the past with nvarchar too plus it takes more space and computing power plus it is pretty much an all english environment thus no real need for nvarchar. i think you are right with the special formatting not working in a regular textbox/data grid view. I wonder if there is away around that though to ignore which ever charaters.
you could use regular expressions to filter the output for testing(until you figure out whats wrong) and only allow certain characters or classes of characters and see what fixes your problem, it isnt a very good permanent solution but it should let you quickly see what is causing the problem and figure out a way to prevent it from bieng loaded into the db or find a way to quickly get rid of it. Ive found this useful[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.