how to set input charset to unicode in VB.net or VC++.net - vb.net

Hi there fellow programmers..
i am using Web Browser control in VB.net 2005, the application i wrote shows a webpage on my computer which has 2 text areas, one for input, and the other for output.
my problem is, i need the charset of the whole program to be unicode, coz the charset of the webpage is utf8. and right now, when i process the input text, the output looks like this:
undefinedundifinedundefinedundifinedundefinedundifinedundefinedundifined
any ideas about how i can change the input language of the entire program to utf-8 or unicode ?
thanks

never mind, turned out the program already accepts unicode input, its the javascript inside the webpage that i am using that's creating the error..

Related

Inserting Base64 string into SQL Server

I am building a MVC .NET application. I have a form where a user fills and submits. The form offers to upload a picture. User is presented with an upload screen, the selected photo is cropped and the cropped image is sent to the server in Base64 string format along with other form data.
In the controller, the string is read correctly and I insert the data using Entity Framework. No error is produced up to this stage.
When I open up the related table using the SSMS though, I can see every record in my table except the Base64 string. It does not display NULL either. Just an empty cell.
When I try to manually enter the Base64 text by copying and pasting the 108,537 character long string, I get the well-known "data would be truncated" error. That rang the bell for me to check the data type I am using. So, I tried both text, ntext and nvarchar(max) which produced the same error.
So this now makes me think that my Base64 string is too large however, I that string is generated by the plugin I am using to crop the image. I tried many images in all sort of sizes and obtained similar length strings.
I am wondering what is it that I am doing wrong or what is it that I am not doing at all? Anyone have gone through a similar issue before?

MS Access VBA code editor character encoding and copy/paste

What is the actual encoding used in Access' VBA editor? I have been searching for a concrete answer for quite a while but with no luck.
I thought it was UTF-8 but I'm not very certain.
My main issue is that when writing a query in VBA I sometimes need to test it in Access' query editor. When copy-pasting however, I lose my native characters (greek in my case) as they turn to gibberish.
I have tried pasting in a text editor and saving it as different encodings but I can never recover the original characters.
Thanks in advance.
Edit
Let me explain this a bit further:
As you can see I can write my greek characters in the VBA editor normally:
However, copying the first line in Access' query editor, I get the following:
Same goes for a simple text editor:
So I am inclined to think that the problem lies inside the clipboard, due to the encoding used for the greek characters. I guess they are not Unicode, as I indeed have to make the change in the System Locale for non-unicode characters. So how are these characters saved/copied? In what encoding?
Answer
Actually this problem was solved by switching the keyboard input language to greek (EL), when copying the actual test string.
I am still not sure however, as to why that happens. If anyone can provide some insight into this, I would love to hear it.
Thanks again
The VBA editor does not support Unicode characters, either for input or display. Instead, it uses the older Windows technology called "code pages" to provide support for non-ASCII characters.
So, the character encoding in the VBA editor corresponds to the code page that is used by the Windows system locale as specified in the "Regional and Language Options" control panel. For example, with my system locale set to "Greek (Greece)"
I can enter Greek characters into my VBA code
However, if I switch my Windows system locale back to "English (United States)"
and re-open my VBA project, the Greek characters have changed to the corresponding characters in the new code page
If "Control Panel" -> "Regional and Language Options" -> "System Locale" is set correctly but you still suffer from this problem some times then note that while you're copying your keyboard layout must be switched to the non-English language.
This is applicable to all non-unicode-aware applications not only VBA.
Credit goes to #parakmiakos
details in this: http://www.pcreview.co.uk/forums/use-greek-characters-visual-basic-editor-t2097705.html
Looks like making sure your OS is set properly, and font choice inside the VBA editor.
I had a similar problem with Cyrillic characters. Part of the problem is solved when set the System locale correctly.
However, The VBA editor still does not recognize cyrillic characters when it has to interpret them from inside itself.
For example it can not display characters from the command:
Msgbox "Здравей"
but if the sheet name is in cyrillic characters it does it well:
Msgbox Activesheet.Name
Finally, it turned out that these kind of problems were solved when I changed to 32 bits version of MS Office.

How to detect characters with unknown encoding (like Textmate)?

Textmate does not allow open a file with characters in unknown encoding. For example, when a wrong encoding is selected, the Open button is disabled:
When a proper encoding is selected, the Open button is enabled:
Is there a c or Objective-C library for reporting characters encoded outside current encoding?
create .tm_properties file in your home dir, then put this code in it:
[ attr.file.unknown-encoding ]
encoding=gbk
this will set default encoding to gbk when Textmate 2 don't know file encoding.
also you can put this .tm_properties file in project root to use this setting within project only.
The usual approach is to load the text assuming a certain default encoding (like UTF-8/16 or latin 1). If there's a BOM at the start of the text then this is very good indication that the text is some form of Unicode. The BOM also helps to find what transformation format is used (UTF-8 etc.).
If loading the text still fails then it's time to ask the user for a hint (charset selection), because it's difficult to guess what the used encoding is.

Understanding RTF and edit it with vb.net

I have this RichTextbox in my vb.net form and I would like to when a user click a button, for example to embold the selected text, how would I do this.
Also, I do NOT want to use the standard vb.net expressions such as RichTextBox1.SelectedText.Font.Bold = True. I want to do something like RichTextbox1.SelectedRTF="[bold]" & RichTextBox1.SelectedRTF & "[/bold]" or whatever RTF looks like.
Can I just add the RTF options random places or can a RichTextBox return an error if the text is in wrong format. I'm mostly looking for info on how to work with RTF without using the standard vb expressions. Thank you very much for any help provided
It just doesn't work this way, it is not an HTML editor. Hacking RTF directly is technically possible through the Rtf property but very hard to get right. RTF is not exactly a friendly format. Start reading here, try not to panic at the quality of that first page. Well, go ahead.

How can I add Arabic typing in VB.Net?

I want to add Arabic typing in VB.Net. How can I do that?
It already supports it; it's all unicode under the hood now. If your users have an arabic keyboard layout the standard controls and inputs should accept arabic text. You do need to make sure to use a system that supports unicode for any persistence you use (database, config files, etc), but the vb.net layer should already work.