Hi I had a string which consists both english and hindi characters. I want to write this in a unicode file, but some junk has been observed in the file. But, if i try to write the same data in utf8 file, it is perfectly written as it is. what is the error? How can i solve this? the code is as follows: string str1 = "This"; string str2 = "यह"; string str3 = str1 + "~" + str2; StreamWriter sw11 = new StreamWriter(File.Open(@"C:\abc.txt", FileMode.Append)); sw11.WriteLine(str3); sw11.Close(); str3 = Encoding.Unicode.GetString(Encoding.Convert(Encoding.ASCII, Encoding.Unicode, Encoding.ASCII.GetBytes(str1))) + Encoding.Unicode.GetString(Encoding.Convert(Encoding.ASCII, Encoding.Unicode, Encoding.ASCII.GetBytes("~"))) + Encoding.Unicode.GetString(Encoding.Convert(Encoding.UTF8, Encoding.Unicode, Encoding.UTF8.GetBytes(str2))); StreamWriter sw12 = new StreamWriter(File.Open(@"C:\abcd.txt", FileMode.Append)); sw12.WriteLine(str3); sw12.Close();
svt gdwl
Posts
-
How to write a utf8 string in a unicode text file using c#? -
How to Find the Control of a window opened in c#Hi, I had window Form application in which some text is entered in TextBox and On a button Click, the text in the textbox should be copied through clipboard and those text has to be pasted on other window which has been opened. I have copied the text through if(String.IsEmptyORNull(TextBox1.Text)) string CopiedText = ClipBoard.SetText(TextBox1.Text); i.e., For example, If I want to paste the copied text in the internet explorer in which http;//www.google.com/ is opened, I have to paste that copied text in the searchbox of google site opened in internet explorer. I have tried to Find the handle through IntPtr IEHwnd = FindWindow("IEFrame", Null); and there after If(IEHwnd != IntPtr.Zero) { MessageBox.Show("Handle Found"); SendMessage(IEHwnd, WM_PASTE,0,0); } But This is also doesn't effect? How to approach?
-
Installation error (Microsoft.Mshtml.dll could not load)?Hi, I had a setup (of plugin of IE) (named Setup1) build in vs2005. Earlier If I used to install this setup on other PC's which doesn't have vs2005 and has only .Net framework2.0, the setup gets successfully installed. After few days, I had installed vs2008 in my PC. After that, I had took the code of Setup1, rebuilt the dll, made a setup (named Setup2) using vs2005. The main thing is, I had observed one thing, the new setup (i.e., Setup2) gets successfully installed on developing machines, but it gives the following installation error on the machines which does not have vistualstudio, eventhough, .Netframework2.0 and windowsinstaller3.1 is present. The error is: Exception occured while initializing the installation: System.IO.FileLoadException: could not load file or assembly 'Microsoft.mshtml.dll, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. StrongName validation failed. (Exception from HRESULT:0x8013141A). But on the same, Setup1 gets succesfully installed. But setup2 gives this installation Error. If I run vs_piaredist.exe first and then run the Setup2, Setup2 also gets successfully installed. Why is this happening with Setup2? why doesn't this happen with Setup1?
-
Alignment of brackroung gets changed in master page design viewWill master page build in visualstudio 2008 express edition gets changed when the page is opened in visualstudio 2008 professinal edition? I had created a sample master page in visualstudio 2008 express edition and when I opened the same website on other PC to work on it, I had observed that that alignment of <div> tags gets changed in the masterpage. Why this is happening? Can anyone suggest something to solve this?
-
How to find the path of a PDF based on corresponding URL opened in IE?For a specific url which is opened in IE, I want the details temporay internet files (like images, textfiles, pdfs) of that specific URL. I try to retrieve all those information through wininet functions like FindfirstURLcacheEntry, FindNextURCacheEntry, GetUrlcacheEntryInfo, I tried to make a log about all the details which can be obtained from temporary internet files for that specific url, I observed that I was unable to get the PDF path which exists in temparary internt files. How can I get this, Is there any other method to get that PDF? If anyone knows something, plz suggest some solution. thank you
-
How to save a web page opened in Mozilla using c#If I open a web page (http://www.google.co.in/) on Mozilla firefox, How can I save to a specific Path (e.g., "C:\New Folder\WebPage.html")? How to do this using c#
-
How to uninstall (remove from "Add or Remove Programs") a setup which is build in vs2005?Hi, I had an application of BHo developed using Vs2005 c#. I build a setup in Vs2005. In the installation folder, I added my dll and Microsoft.Mshtml.dll. In the "Uninstallation" folder also, I added the same (my dll and Microsoft.Mshtml.dll). while Uninstalling the is an error "Exception occured while initializing the installation. 'System.IO.FileNotfoundException': could not load file or assembly "file:///C:\Program Files\ AB\SetupName\MyDll.dll' or one of its dependencies. The system cannot find the file specified." How to solve this? Now my setup is not getting "UnInstalled". I tried in many ways, but unable to remove it form my "Add or Remove Programs". How to remove this setup from my add remove programs.
-
How to create MimeFilter in c#Hi How can I implement the Mimefilter in c#. I had got some links related to these http://msdn.microsoft.com/en-us/library/aa767916(VS.85).aspx[^] Is there any other information related to these? actually I want to change the web page text on the fly, such that the user can see the changed text directly on browser? How to do this
-
A project setup build in VS2005 is not getting uninstalled?Hi I had an in-process dll built in vs2005 c#, I had made a setup by using Setup and Deployment options, During uninstall, it is showing a message box that a sub key in the registry is unavailable, so ignore this error and continue. If I click OK, the setup is not gets uninstalled. How to remove this setup already installed? what is the problem in this? This may be the small issue, but many times this error wasting my time. Can anyone suggest how to avoid these kind of error, and also how to remove the setup which is not getting uninstalled?
-
How tro read the text of a PDF file opened in adobe Reader using c#When a pdf file is opened in adobe reader 8.0, how to read the adobe reader text, can anyone suggest how I can achieve this in c#? Is acrobat SDK required for doing this...
-
How to save a PDF file whch is opened on IE?when a PDF file is opened in IE, I have to save that PDF without asking the user to save. How to do this in c#? Normally I am able to save the HTML pages opened in IE, but PDFs are not saved. Is there any way to save the currently opened PDF without asking user to save?
-
C# BHO problemHi I had BHO developed in vs2005. I work on IE6. I do all the things when the progresschange event fires... http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx\[^\] The main thing is when I open 3 instances of IE, consider in first instance, http://www.google.co.in/\[^\] is opened, in second instance, http://www.msn.com/\[^\] is opened, in third instance, http://in.yahoo.com/?p=us\[^\] is opened. when these are opened the ProgressChangeEvent is fired, but when return back to the window of 2nd instance (i.e.,http://www.msn.com/\[^\]) and refresh it, no progresschangeevent is fired. which event can be fired when changing the focus from one window to other, "WindowStateChanged" event should be fired, but when I open solution explorer of my project, this event is not visible in intellisense. Why WindowStateChanged event is not obtained in my Project solution. And, using the BHO can't we get the handle of previously opened instance(which is currently active, like 2nd instance after openeing three instances of IE.) I had already posted this in http://www.codeproject.com/Messages/3165774/Csharp-BHO-problem.aspx[^] but I think this is the forum that I can get some suggestions. I was doing all these in Windows XP Service Pack 2 (SP2).
-
C# BHO problemHi I had BHO developed in vs2005. I work on IE6. I do all the things when the progresschange event fires... http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx[^] The main thing is when I open 3 instances of IE, consider in first instance, http://www.google.co.in/[^] is opened, in second instance, http://www.msn.com/[^] is opened, in third instance, http://in.yahoo.com/?p=us[^] is opened. when these are opened the ProgressChangeEvent is fired, but when return back to the window of 2nd instance (i.e.,http://www.msn.com/[^]) and refresh it, no progresschangeevent is fired. which event can be fired when changing the focus from one window to other, "WindowStateChanged" event should be fired, but when I open solution explorer of my project, this event is not visible in intellisense. Why WindowStateChanged event is not obtained in my Project solution. And, using the BHO can't we get the handle of previously opened instance(which is currently active, like 2nd instance after openeing three instances of IE.)
-
How to catch the data that is going to be displayed on IE?In IE, when You type some URL in the address bar, corresponding web page will be displayed on screen. How to catch this web page data on IE, using c#.
-
How to add a toolbar in a window using c#How to add a toolbar using windows forms programming of c#
-
How was use namedpipes to communicate with other application in a network?I was using vs2005. In this how can I built
-
How was use namedpipes to communicate with other application in a network?Hi I want to communicate b/w two applications using namedpipes in c#. when I googled, I found the link http://books.google.co.in/books?id=9fAmRzYaxFgC&printsec=frontcover&dq=oreilly:+C%23+cookbook#v=onepage&q=oreilly%3A C%23 cookbook&f=false which is given in the recipe 16.5, but I doesnot understand how to attach those files to server and client?
-
How to load a button in taskbar through c#I want to load a button in taskbar, Such that I can give some options to user for selecting. For example, if there is the button of open office 2.1 Quickstarter, and if I rightclick it, there comes some options like Text Document, spreadsheet, Presentation, Drawing, database etc., In the same way, If I right click the button which is loaded through my program, therre should come some options for user to select. How to do these in c#?
-
How to catch the data that is given for print using c#If a text file is opened and given to print for a printer installed on the PC, how to catch the data that is going to printer before it gets printed.
-
How to extract text from a PDF file using c#?How can I extract PDF file text from the file "c:\\Abc.pdf" using c#? when I read the file text, it is get like %PDF . . . . %%EOF There is some junk data visible in between these. How to uncompress the compressed PDF file data. How to read the text from the PDF file?