[SOLVED] Can't save UTF-8 encoded source file in IDE

I had a problem where I could not save a c++ source file from anjuta using the gtksourceview plugin, but could using the scintilla plugin.  I would get an error message with "invalid byte sequence in conversion input" in the text.  Eclipse CDT also would not save a modified file with a similar error message.
The fix was to uncomment the proper lines in the file /etc/locale.gen for my locale and run locale-gen as described in the Archlinux wiki article "Configuring locales."
I did not find any help for this problem using internet searches, so I thought I would document it here.  Just in case someone else fails to setup their locale and runs into the same trouble.

I think so (haven't checked), but it is a really simple test xml which is not really error prone).
But the problem is a different one, because I also just tried to read a txt file with some Japanese characters into an NSString using initWithContentsOfURL.
When I print the string in the console, I only get messed up characters (the latin characters next to the Japanese are displayed fine).
It is a general problem of reading out an UTF-8 file from an url.
Spent the whole last night to google something helpful but couldn't find anything. Now I'm tired at work
Thomas

Similar Messages

  • How can I save a Flash or .swf file in AVI format without losing quality?

    How can I save a Flash or .swf file in AVI (or another video) format without losing quality?

    As long as you don't have code in your animation then just hit File->Export->Export Movie, then configure the options.
    Here's an article on exporting sound, images and video. Just skip on down to exporting AVI and it explains the process. The codec is in the Video Compression section. When you click Settings for Video Compression, the codec is in the drop-down at the top. There's various kinds but to get lossless quality AVI you'll have to choose Uncompressed / None for full quality. Again, the file will be huge and you'll need to use another program (like Adobe Media Encoder) or Microsoft Windows Media Encoder, etc, depending on what format you intend to compress it ultimately.
    http://helpx.adobe.com/flash/using/exporting.html#exporting_video_and_sound

  • How can I save a Photoshop Elements 12 file as HTML?

    How can I save a Photoshop Elements 12 file as HTML?

    Sorry, not possible in PSE itself. You'd need to put your photo into the web creation software you use. If you are using an older version of PSE some versions created web albums/galleries which included an index.html page, but that's as much as PSE does. There's nothing like that in PSE 12 since Adobe wants you to use Revel for photo sharing now.

  • Can't save the illustration.  The file may be read only, or the file is in use by another applicatio

    Getting error "Can't save the illustration.  The file may be read only, or the file is in use by another application."  The file is not read only and is not in use by another application.

    The same thing may happen in Windows Explorer, specifically if it is a very big file (physical size), so preparing the preview may take a lot of time.
    In that case it is used by "another application", that is: Explorer.
    By the way, which version of Illustrator are you using, Tetons?

  • Can i save streaming audio to a file on my iMac?

    Is there a relatively easy way to save audio to the hard drive?  Most audio capture and editing software seems to have too many extra features and looks complicated? (this is my first Mac)  We would jst like to save an occasional file to replay later.  Thanks in advance, Pat

    Just found this reply to a similar question:
    True "streaming" media (served from streaming server protocols like RTSP) are not cached so you can only save a "link" to the file.  99.9% of Internet media isn't streamed. They download.
    Is it then possible to capture (with software) something we listen to on the Internet - cached or not? 

  • How to save a UTF-8 encoded text file ?

    hi People
    I have a little script which reads the source text from a layer and saves it to a .txt file. This is on a Mac and all was good until recently when I tried opening the .txt file on a PC in Notepad and found my ˚ degree symbols all whack.
    Resaving the .txt file in TextEdit as Unicode (UTF-8) encoding solved the problem, now opens fine in Notepad.
    But ideally I'd like the script to output the .txt as UTF-8 in the first place. It's currently Western (Mac OS Roman). I've tryed adding in myfile.encoding = "UTF8" but the resulting file is still Western (and the special charaters have wigged out again)
    any help greatly appreciated../daniel
        var theComp = app.project.activeItem;
        var dataRO = theComp.layer("dataRO").sourceText;
        // prompt user to save file
        var theFile = new File ("~/Desktop/"+ theComp.name + "_output.txt");
        theFile = theFile.saveDlg("Save an ASCII export file.");
        if (theFile != null) {          // check user didn't cancel dialog
            theFile.lineFeed = "windows";
            //theFile.encoding = "UTF8";
            theFile.open("w","TEXT","????");
            theFile.writeln("move details:");
            theFile.writeln(dataRO.value.toString());
        theFile.close();

    Hi,
    Got it, it seems, the utf-8 standard use 2-bytes (and more) encoding on accents and special characters.
    I found some info there with some code http://ivoronline.com/Coding/Theory/Tutorials/Encoding%20-%20Text%20-%20UTF%208.php
    However there was some error so I fixed it. (However for 3 and 4 bytes characters i didnt test it. So maybe you'll have to change back the 0xbf to 0x3f or something else.)
    So here is the code.
    Header 1
    function convertCharToUTF(character){
        var utfBytes = "";
        c = character.charCodeAt(0)
        if (c < 0x80) {
            utfBytes =  String.fromCharCode (c);
        else if (c < 0x800) {
            utfBytes =  String.fromCharCode (0xC0 | c>>6);
            utfBytes +=  String.fromCharCode (0x80 | c & 0xbF);
        else if (c < 0x10000) {
            utfBytes = String.fromCharCode (0xE0 | c>>12);
            utfBytes += String.fromCharCode (0x80 | c>>6 & 0xbF);
            utfBytes += String.fromCharCode (0x80 | c & 0xbF);
        else if (c < 0x200000) {
            utfBytes += String.fromCharCode (0xF0 | c>>18);
            utfBytes += String.fromCharCode (0x80 | c>>12 & 0xbF);
            utfBytes += String.fromCharCode (0x80 | c>>6 & 0xbF);
            utfBytes =+ String.fromCharCode (0x80 | c & 0xbF);
            return utfBytes
    function convertStringToUTF(stringToConvert){
        var utfString = ""
        for (var i = 0 ; i < stringToConvert.length; i++){
            utfString = utfString + convertCharToUTF(stringToConvert.charAt (i))
        return utfString;
    var theFile= new File("~/Desktop/_output.txt");
    theFile.open("w", "TEXT");
    theFile.encoding = "BINARY"
    theFile.linefeed = "Unix"
    theFile.write("");//or theFile.write(String.fromCharCode (0xEF) + String.fromCharCode (0xEB) + String.fromCharCode (0xBF)
    theFile.write(convertStringToUTF("Your stuff éàçËôù"));
    theFile.close();

  • Can't use UTF-16 encoding with XML Parser for Java v2.

    This is my XML Document:
    <?xml version="1.0" encoding="UTF-16" ?>
    <Content>
    <Title>Documento de Prueba de gestin de contenidos.</Title>
    <Creator>Roberto P     rez Lita</Creator>
    </Content>
    This is the way in which i parse de document:
    DOMParser parser=new DOMParser();
    parser.setPreserveWhitespace(true);
    parser.setErrorStream(System.err);
    parser.setValidationMode(false);
    parser.showWarnings(true);
    parser.parse(
    new FileInputStream(new File("PruebaA3Ingles.xml")));
    I've got this error:
    XML-0231 : (Error) Encoding 'UTF-16' is not currently supported.
    I am using the XML Parser for Java v2_0_2_5 and I am a little
    confused because the documentation says that the UTF-16 encoding
    is supported in this version of the Parser.
    Does anybody know how can I parse documents containing spanish
    accents?
    Thanks in advance.
    Roberto P     rez.
    null

    Oracle just uploaded a new release of V2 Parser. It should
    support UTF-16.
    Yet, other utilities still have some problems with UTF-16
    encoding. Seems we just
    have to wait this one out.
    BTW, I'm trying to use Japanese. We, also, have some problems
    with JServer.
    Roberto P     rez (guest) wrote:
    : This is my XML Document:
    : <?xml version="1.0" encoding="UTF-16" ?>
    : <Content>
    : <Title>Documento de Prueba de gestin de contenidos.</Title>
    : <Creator>Roberto P     rez Lita</Creator>
    : </Content>
    : This is the way in which i parse de document:
    : DOMParser parser=new DOMParser();
    : parser.setPreserveWhitespace(true);
    : parser.setErrorStream(System.err);
    : parser.setValidationMode(false);
    : parser.showWarnings(true);
    : parser.parse(
    : new FileInputStream(new File("PruebaA3Ingles.xml")));
    : I've got this error:
    : XML-0231 : (Error) Encoding 'UTF-16' is not currently supported.
    : I am using the XML Parser for Java v2_0_2_5 and I am a little
    : confused because the documentation says that the UTF-16
    encoding
    : is supported in this version of the Parser.
    : Does anybody know how can I parse documents containing spanish
    : accents?
    : Thanks in advance.
    : Roberto P     rez.
    null

  • [SOLVED]Can't save a file with tex extension using vim

    Hello there people,i decided to learn LATEX but vi won't let me save my files with the tex extension.It says:
    "test.tex" E212: Can't open file for writing
    Does anyone know why vim is denying to save it with this extension?Please help!
    Last edited by sepuku (2011-06-04 01:21:44)

    I just noticed that when i'm in /home/sepuku i'm able to save the files normally.But i created a directory specially for latex!
    So when i cd /home/sepuku/latexprojects i can't save anything.I think that this has something to do with the permissions maybe?And how to i make my user able to copy/paste/remove /edit/create files and dirs? :S
    ls -al test.tex returns:
    -rw-r--r-- 1 sepuku users 70 Jun 4 06:01 test.tex

  • Can GhostScript handle UTF-8 encoded files?

    Is there a way to tell GhostScript that its input file is encoded in UTF-8?

    I don't know much about this, so this is almost curiosity more than anything, but wouldn't that usually be handled by a process run prior to gs? That is, by whatever produces the postscript which is to be passed to gs? In TeX, for example, the flow would usually go input -> TeX/LaTeX/whatever -> dvi output -> dvi to ps processor -> ps output -> gs -> final output (dependent on device). It's the initial processor which usually needs to know whether the input is UTF-8 encoded or whatever.
    - cfr

  • How to read UTF-8 encoded text file randomly?

    I am trying to read a text file which has been encoded in UTF-8. The problem is that I need to access the file randomly. The RandomAccessFile is a low-level class and there seems to be no-way to wrap it in InputStreamReader so that UTF-8 encoding can be done on-the-fly. Is there any easy way to do that. Below is the simplified version of my program.
    import java.io.*;
    public class Test{
            public Test(String filename){
                    try{
                            RandomAccessFile rafTemIn = new RandomAccessFile(new File(filename), "r");
                            while(true){
                                    char chr = rafTemIn.readChar();
                                    System.err.println(chr);
                    } catch (EOFException e) {
                            System.err.println("File read.");
                    } catch (IOException e) {
                            System.err.println("File input error");
            public static void main(String[] args){
                    Test t= new Test("template.idx");
    }

    The file that I am going to read could be few hundreds of MBs or GBs. Hence, I will index interesting items in the file. The index file contain the keyword and the byte offset in the file. So, I will need to seek to any byte to read it. The file could be UTF-8 encoded XML or UTF-8 encoded plain text.
    Also, would like to add-up that in the sample program above I am reading the file sequentially. The concerned class has another method which actually does the reading randomly. If this helps, I am pasting the simplified version of code again but this also includes the said method.
    import java.io.*;
    public class Test{
            long bloc;
            long eloc;
            RandomAccessFile rafTemIn;
            public Test(String filename){
                    bloc=0L;
                    eloc=0L;
                    try{
                            rafTemIn = new RandomAccessFile(new File(filename), "r");
                            while(true){
                                    char chr = rafTemIn.readChar();
                                    System.err.println(chr);
                    } catch (EOFException e) {
                            System.err.println("File read.");
                    } catch (IOException e) {
                            System.err.println("File input error");
            public String getVal(String templateName){
                    String stemval=null;
                    try {
                            rafTemIn.seek(bloc); //bloc is a long value for beginng location to read from. It changes.
                            byte[] b = new byte[(int)(eloc - bloc + 1L)];
                            rafTemIn.read(b,0,(int) (eloc - bloc + 1L));
                            stemval = new String(b,"UTF-8");
                    } catch(IOException eio) {
                            System.err.println("Template Dump file IO error.");
                    return stemval;
            public static void main(String[] args){
                    Test t= new Test("template.idx");
                    System.out.println(t.getVal("wikipedia"));
    }

  • Conforming in HDV:can I save on hd the m2t file instead to send to camera ?

    Hello!
    I use a Sony HVR V1 and FCP 6 to edit HDV footage.
    My Sony PlayStation 3 handles mpeg 2 files very well.
    I acquire with FCP by firewire, I edit and after conforming I use print to video to export to camera.
    After I use Apple DVHSCap to get from camera the m2t file , I rename it to m2v and I put it on the PS3.
    Can I avoid to export to camera and to re-acquire from camera ?? Can I save the file m2t that creates FCP after conforming on Hard Disk instead to send it to the camcorder ?
    For me is important to get native m2t file to obtain higher quality.
    A question: why a m2v file on Mac with VLC is not very smooth like on PS3 ?? On PS3 is true smooth, on Mac is choppy and I see the artifacts of interlacing.
    Excuse me if my english is not too good
    Thank you in advance
    Ciao
    Cino
    Italy

    your workflow is little confusing...
    m2t is a transport stream, which contains both video and audio multiplexed into one file. m2v is an elementary stream, containing video only. You are not accomplishing anything by changing the extension to m2v.
    The quality of the video is not in the extension, it is in the encoding. When you export to the camera in HDV mode, you are letting the camera encode back to mpeg2. Don't know how much control you have over the encoding process there. YOu are most likely bound by the presets the camera has. If you use Compressor you can encode to mpeg2 m2v, mpeg2 m2t, mpeg2 with layer1 audio program stream, and many others.
    I would read up on video compression both in your manuals and on the web. There is a lot to know about it to get good results.
    Don't judge the quality of the video on your computer screen. You should plug your computer into the television if you don't have an external video monitor, and compare the two then...

  • How can I put more than one source file when I am creating my installer from LV 7 Express

    Hi,
    I am creating my installer for my application and I would want to add more than one source file at once, how could I do it?
    Thanks,
    ToNi.

    Hi,
    I'm referring to the first executable. In other words, I have my application and I want to build and executable of it. Then I go to "Tools->Build application..." and then in the source files tab I can add my vi files but I want to add more than vi at the same time (at once) and not one by one. How can I do it?
    And my second question is: When I make the installer for my application I save the configuration in a build Script file (.bld) in order to use it whenever I want. Then If from another computer different from the one where I generate the .bld file, I load it, LV tells me that something is wrong (LV says there are some errors in some VIs but It doesn't tell me what files are). Why?
    Thanks in advance,
    ToNi.

  • I use iMac desktop. I can't save web pages as PDF file by using Firefox, but by Safari is fine.

    I'm using Mac OS X 10.6.4. Today, I tried to save my email content as a PDF file. However, I only got a PDF file that have partial content of email. Then I adjust the printer setting and did it again, then I only got a blank PDF file. There was nothing inside. Then I tried to save email as a PDF file by using Safari browser. And I got a complete and sucessful PDF file. I usually save web pages or web mail, online receipt as PDF file by use Firefox. But since I have updated to the new version, there were many problems with my Firefox. I tried to restore all my application and made Firefox in the old 3.6.3 version which I used to have no problem. But now still not working.

    I solved it for myself: it was my HP smart-web printer crap that was a plug in and add on for firefox that somehow automatically got installed when I upgraded to 5. I disabled both in the add-ons manager, and voila, printing is working.
    It seems there are many things, like this and the Google toolbar, that were screwed by the oddly fast update to 5. Looks like Mozilla didn't give anybody any notice! Must've been some really bad security hole.

  • How can multiple users work on one source file?

    Hi There,
    I'm currently working on a project that I would like to hand-off to another person to finish. I've tried sending the source file located in at: Home>Movie>iMovie Projects but apparently that doesn't work as the second user is unable to work on the project.
    Is this achievable? If so, how?
    Thank you in advance for any help! It's greatly appreciated =)

    For iMovie 09, you:
    You have to plug in an external drive, and within iMovie, drag the project file to the external drive. It will ask you if you want to "copy project" or "copy project and events".
    If you want to move the project and not just make a copy, then hold down the Command key while you drag the project file to the external drive.
    iMovie 08 does not have the capability of having project files on the external drive, but you can try to manually copy it to the external drive with the finder, and then move the associated events +from within iMovie+ (critical for the other machine to find the files) and when copying the project file to the other computer, it would be critical to find the iMovie project folder in the Movies folder and put it in exactly the same place on the other machine. Otherwise iMovie won't find it.
    The way you want to use it, iLife09 might be worth the upgrade, especially if my suggestions don't work.

  • How can we handle graphics in DITA source files in order to display them correctly both in PDF and H

    We are using FM9 to publish PDF and HTML output from DITA source files and we cannot find a way to display images correctly. By adjusting the appropriate DPI, the image gets correctly displayed in HTML but not in PDF where it appears cropped according to the the text frames of the source file in FM9, like this:
    We have tried to enlarge the text frame in the source file but for some reasons FrameMaker doesn't take these changes into account.
    By modifying the attribute of the element <fig> (expanse = page), it was possible to improve a bit the rendering in the PDF but not completely.
    Our graphics are in JPG format.
    Any help on this is highly appreciated.
    Thank you.

    Hi Al@s...
    DITA doesn't provide a way to store additional information about anchored frame properties (since there is no "frame" element, just image), that's why FrameMaker doesn't allow you to set the frame size to something other than the image dimensions.
    The "standard" DITA way to reference an image with two different DPIs is to insert multiple fig/image elements and conditionalize (via attributes and ditaval) each image so it shows up in the proper output. This can be a bit tedious to insert two images for each instance, but that's the typical way to handle it (unless you've got a CMS that switches the images for different output types).
    If you use DITA-FMx, it provides a "fmdpi" feature which allows you to tag an image with the DPI you want to use in the FrameMaker-generated output, but the DITA coding sets no DPI (or height/width), so it uses the default image size for your HTML output.
        http://leximation.com/dita-fmx/
    Cheers,
    ...scott
    Scott Prentice
    Leximation, Inc.
    www.leximation.com

Maybe you are looking for

  • External HDD not getting detected?

    My 250GB Transcend External HDD is not getting detected. Help please. Even yesterday, I had used it successfully. I don't have a clue what happened. Last edited by armageddon09 (2009-10-14 12:49:39)

  • Calculating valuation basis for ALP (alternate payments) in Schema UT00

    Hello Experts! I have a requirement that I'm trying to fulfill with a PCR but thus far have been unsuccessful. In the standard schema UT00, rule U010 calculates the valuation bases according to IT0008. If you have two WTs in IT0008 it'll take both in

  • How to generate an interrupt using DI change detection on m-series card

    Hi, I want to generate an interrupt on the positive edge of a digital input signal on the IO connector. Does anybody know how to configure an m-series card (PXI-6224) for this use through RLP programming? Thanks in advance, Richard

  • FBCJ - Badi CJ_DOUMENT is not run

    I have created Z Implementation ZCJ_DOCUMENT for Badi definition CJ_DOCUMENT. I put a very simple code into CHANGE method of my ZCJ_DOCUMENT. DATA: txr. txr = '1'. I want to see if the Badi is called in FBCJ - so I put a breakpoint on the above. But

  • Automate PO Complete from SRM to ECC

    Hi All, To Automate PO Complete from SRM to ECC i am using BADI BBP_ECS_PO_OUT_BADI. In ECC I have to update the following indicators. EKPO-LOEKZ = S (Deletion Indicator in Purchasing Document) EKPO-EREKZ = X (Final Invoice Indicator) EKPO-ELIKZ = X