How to convert files or strings ANSI to UTF - 8?

I have a program that reads a file line by line and writes to the other. If the original file is in ANSI format, then the result is ANSI as well, and if the original is UTF - 8, the resulting as well. How can I change this behavior so that all output files are coded with BOM or without UTF - 8?

Hello user,.

Read the file with ascii: InputStreamReader (InputStream, Charset)
API: http://download.oracle.com/javase/1.5.0/docs/api/java/io/InputStreamReader.html#InputStreamReader%28java.io.InputStream, %20java.nio.charset.Charset%29

Write the file UTF - 8 = OutputStreamWriter (OutputStream, Charset)
API: http://download.oracle.com/javase/1.5.0/docs/api/java/io/OutputStreamWriter.html#OutputStreamWriter%28java.io.OutputStream, %20java.nio.charset.Charset%29

Thank you.
Narayan

Tags: Java

Similar Questions

  • I copied the 2 files to a DVD movie and he changed the .m2ts file format and it is not supported by Windows Media Player. How to convert files in a file type supported?

    Original title: M2TS

    I copied the 2 files to a DVD movie and he changed the .m2ts file format and it is not supported by Windows Media Player.  How to convert files in a file type supported?

    Hello

    The files have already been burned on a DVD and therefore cannot be converted. However, you can download and install third-party codecs to play .m2ts files.

    Codecs: Frequently asked questions

    WARNING OF THIRD PARTY
    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • How to convert int to String

    How to convert int to String. I get the error 'cannot convert integer to int.

    Dim str As String = "abc";

    int NB = Integer.valueOf (str);

    Use Integar.parseInt (). But make sure your str contains the integer value (like str = '123') otherwise you will get the exception.

    String str = "123"; int num = Integer.parseInt(str);
    

    Concerning

    Bika

  • How to convert files atn shares from mac to pc?

    How to convert files atn shares from mac to pc?

    looks like you were able to load the action but in error during playback.

    And Yes, if a particular document was references during the recording of the action then, you would not be able to play because he will try to find the same document on the references of exact location while recording.

    In this case, you have to re-create the actions that refer to a particular file of the machine (with the files Dropbox would not help).

  • How to convert files larger than 100 MB?

    How to convert files larger than 100 MB?

    Hi weysider,

    The Acrobat.com online services limit downloads of files of 100 MB or smaller. For larger files, you can use Acrobat. Please do not hesitate to try Acrobat for 30 days. See www.adobe.com/products/acrobat.html for more information on a free 30 day trial.

    Best,

    Sara

  • How to convert file muse in html

    tell how to convert a file of muse in html get external css file.

    Hello Rukshanb77797922,

    If you are looking for the HTML files that muse will export to your server then you can get these files from file > export to HTML

    Kind regards

    Vivek

  • Recently signed (89.00). Replied to the confirmation e-mail. I chose to convert a Word file. Can not find the converted file. Link sends me right back to the subscription page. Cloud shows no files available to view. In Mac Help. How to convert file?

    How to find converted files? Using a Mac.

    Hi gerardb7002580,

    You will be able to find your document exported under tab https://cloud.acrobat.com/recent file, select it to download.

    Kind regards
    Nicos

  • How to convert files in file .pcm without windows XP audio .wav?

    I'm trying to put audio in flash professional from a .wav and it won't let me

    Apparently, I need to convert a .wav in a file audio .pcm. But from what I've been

    try to understand, that apparently can be done without windows XP.

    If anyone knows how to convert a .wav in a .pcm on a 8.2 windows

    Please tell me.

    Move to Adobe animate CC - general

  • Since the upgrade to CS6, I see is no longer how to convert files from, for example, a PDF to JPEG and vice versa.  It used to be so simple.  Can anyone help with this?

    Since the upgrade to CS6, I say is no longer how do to convert files from, for example, a PDF file as a JPEG or another type (gif, png, etc.).  When I look at the file in the Finder it simply brings me directly to my original in inDesign document, rather than to appear on the left side of the screen with the save option under sub folder as it did before.  Does anyone know how I can convert the files, I need to do a lot!

    ???? Conversion of files with InDesign? Never have been possible. The only thing you could and can do is to export an InDesign document. You can export to PDF, jpg, etc. just like before.

  • How to convert file psf to psd

    I received a file of psf from a customer.

    How to convert a PS file?

    I get an error message when I try to load in PS.

    I have PS CS5 Extended

    I discovered that his file was created in 'The Print Shop for Mac' which explains why the file was so stubborn on opening.

    Same File Viewer displays only the code and not the image. My wife, one of our crew, managed to divide the PDF file made by this program

    in Coreldraw and give me the parts I needed. My problem is solved. Thank you all for your imput.

    Gene

  • How to convert the Ascii string containing hex to hex string info?

    Dear all,

    I am busy doing a control/reading program for pumps of ISCO.

    Right now I'm in trouble with to send orders for PUMPS in HEXADECIMAL. When I use a CONTROL to the STRING in HEX display, everything works fine (when I manually write down the command in the control of the chain).

    Exist it a couple of pieces order: string Destination, length, ordering, Checksum. I'm doing a sup - screw that automatically calculates the checksum (modulo 256) and adds it to the string. Everything is going well: first of all, I shared the ascii bytes command and I calculate the checksum and add as ASCII HEXADECIMAL value to the chain of command. Also a CR (= 0d) is added. Now the whole string must be converted to hex. The string contains the right nummers HEX, but they are in ASCII format. Here was I feel worth it, I don't know how to do it!

    So to summarize:

    I have an ascii string that contains the values HEX (for example 315230303652454D4F544531420D) and it must be converted to a HEX string (for instance 3152 3030 3652 454 4531 420 4F54) for the pump of the ISCO can understand the command.

    The VI is attached.

    Thank you in advance,

    Bio

    Bio,.

    This should do what you want.

  • How to convert files audio wpl for use in Adobe Audition 3.0?

    I have some of my own voice-demo files in Windows Media Player as a .mpl file.  I would like to run these through my Adobe Audition 3.0 for editing purposes.  How can I do this?

    You can try this link.

    http://social.msdn.Microsoft.com/search/en-us?query=Windows%20media%20encoder%209%20%26%20Converting%20wpl%20Files&AC=5

    Also, I am sure that the WM Encoder has a download add-on for Adobe conversions.

    The default encoder can convert multimedia (audio/video)...

  • How to convert files iTunes music to Windows Media Player in Windows Vista?

    I am running Windows Vista and have just bought a Palm Treo Pro PDA.  I would like to convert my music files in my itunes folder on for
    Windows Media so that I can upload them on my Palm Treo Pro.  I am a real novice at this computer stuff because I always had someone around to help me.  I have now decided to do it myself up-to-date with technology, so if anyone has an answer for me, they will have to set out very simply so that I can follow.  I'd appreciate any help supply. Thank you

    Hello Babefromthebush,

    Thank you for your message.  Open Windows Media Player.  Click on the Library tab and then add them to the library.  Your files must be located in your personal folder click OK.  Which will add your Media Player files.

    Thank you for using answers Forum. Please let us know how it works.

    Joseph
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to convert double to String without scientific notation.

    Hello

    I'm tring to convert a double 24,000,000.00 in string. But I got a string "2.4E7".

    Someone knows how can I avoid this problem of scientific notation?

    Thank you

    Have you tried to cast to an int?  something like:

    double d = 24000000.0;

    int i = (int) d;

    String s = "" + i; "

    Then just add the rest of your chain to get precision you would like...

    double rest = d & i;

    rest = rest * 100;

    s += "." + (int) remains;

    You would lose little accuracy due to rounding problems, but you can use the functions of rounding in the api to get a closer answer.

  • How to convert files vi 9.0 Labview 7.1 vi?

    Hi, I have a set of LabView 9.0 .vi files that I need to convert the 7.1 .vi, but the latest version of LabView 9.0 only allows me to save in version 8.0. So, my questions are:

    (1) can a user with LabView 7.1 open 8.0 file?

    (2) if not, is there another way to convert 9.0 files directly to 7.1 files?

    Thank you very much!

    It requires two steps.

    You must open the VI in 2009 of LV and make a backup for the previous version back at 8.0 LV

    Open in BT 8.0, then make a backup for previous back to LV 7.1.

    If you don't have a LV 8.0, then you can post the files to downconvert thread and ask it what they converted into LV 7.1

Maybe you are looking for

  • How can I stop getting updated?

    How can I stop receiving updates of apps I don't care / don't want to not updated?

  • The fan starts to every 10-15 sec on Satellite Pro A30

    Hi all My CPU fan / seems to act strangely.The fan comes on every 10-15 seconds for 5-10 seconds.I recently had the A30 and the fan comes on a regular basis even when the PC is not in use.When I put my finger on the radiator, I can feel heat quite ho

  • Portege M400 - Vista installation under the version of BIOS 1.80

    Hello I came to the decision to install vista on my M400. I upgraded my BIOS to 3.40. However, I really only want the quiet fan so I was wondering if it was possible to run Vista under BIOS v1.80 and, if so, whether it would impact performance in any

  • Bet Office 2010 - Microsoft Outlook problems.

    I get error ane ' task - sending ' reported an error (0x8004010F): "outlook data file is not accessible." Only, it started with the upgrade. I have reinstalled the account, sent all test messages and everything went well. However, there are still mes

  • Kein Iconia W 510 Bluetooth Windows 8.1

    Hallo! Mein Iconia W510 wurde seit erhält immer wieder auf den newest Softwarestand gebracht (Bios, Treiber und Betriebsystem). Die Bluetooth Funktion ich habe lange nicht das aber jetzt tun will, really. Probably habe ich unter dem alten system Wind