Opening files with korean file names

This is a discussion on Opening files with korean file names within the C++ Programming forums, part of the General Programming Boards category; Hi there, i have a LOT of texture files with korean file names. The file names show up as(using as ...

  1. #1
    tek
    tek is offline
    Registered User
    Join Date
    Aug 2003
    Posts
    9

    Question Opening files with korean file names

    Hi there, i have a LOT of texture files with korean file names.

    The file names show up as(using as an example):

    ???????\????-01.bmp

    but when displayed with the correct encoding(korean) they show up as:

    ʵٴ\ӹٴ-01.bmp

    Now my question is how do i convert the garbled junk into the understandable, readable korean filenames so i can open them in my c++ application?

    When i printf the file path i want to open in my app, it outputs:

    \307?\345\271?\332\\275\243\274??\332-01.bmp

    into the run console(i'm using project builder in Mac OS X)

    when i try and open the garbled filename using, for example, fopen, it returns null(not found?) and when i try and fclose() it crashes the app.

    also, if i try entering in an absolute korean path manually like this:

    fopen("/DATA/texture/ʵٴ\ӹٴ-01.bmp", "rb");

    I get the warning:
    warning: unknown escape sequence: '\354'
    and fopen returns null.

    If anyone could help me it would be appreciated a lot!

    Here's a screenshot of how different apps are outputting my korean file names. Only finder manages to do it correctly: http://www.playrpg.com/storage/Picture%204.jpg

    Note: the small textedit window is how it should look before being encoded. the style of text in the finder is how it should look after being translated into korean.


    EDIT: to see this post how its meant to be set your browser encoding to korean

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    http://www.tldp.org/HOWTO/Unicode-HOWTO-6.html

    I think that is what you're looking for.

  3. #3
    tek
    tek is offline
    Registered User
    Join Date
    Aug 2003
    Posts
    9
    i don't have the <wchar.h> and <wctype.h> files. according to apple, they are not included with the mac os x developer tools(gcc 3.1, the frameworks etc.)

  4. #4
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Macs don't use Unicode (at least not UTF-16).

    The problem is, you can't usually include non-ASCII characters in string literals; some compilers will allow it though. You will probably have the best luck reading the filename in from a text file; strings read in this fashion should preserve the multibyte encoding.

    Do note, you may need to use multibyte string operations if you want to do things like take the length, etc. In fact, if you have ANY str___() function, you probably need to use a multibyte-aware version.

    BTW, it looks to me like you have a \ in your literal, when you want a /. It's possible that that little thing alone could fix it...
    Last edited by Cat; 08-28-2003 at 11:20 PM.

  5. #5
    tek
    tek is offline
    Registered User
    Join Date
    Aug 2003
    Posts
    9
    I can't change the \ to a /, as its built into a file which is the same for windows and unix. I've tried replacing with a / with a quick fix, but that didn't work.

    If you could explain how i would go about doing what you said, it would be a great deal of help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 01:44 PM
  2. Searching Binary Files for a Pattern
    By CaptainMorgan in forum C Programming
    Replies: 16
    Last Post: 06-17-2007, 07:04 PM
  3. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 02:19 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21