Gibberish in Xcode

Discussion in 'iOS Programming' started by hmemcpy, Jun 3, 2011.

  1. hmemcpy, Jun 3, 2011
    Last edited: Jun 3, 2011

    macrumors newbie

    Jun 3, 2011
    Hey, new to programming...

    When in XCode I'm running into a problem.

    Window based App.

    With classes folder selected I go to file/new / UIView / Objective-C class

    But, both files that are created have only gibberish for text, as viewed in the coding section of Xcode. Also, if I drag and drop the newly created .h and .m files from the classes folder into a ASCII text editor, their fine, no gibberish.

    Anyone seen this?

  2. macrumors regular

    Aug 28, 2008
    Right click on file, Get info, check File Encoding
    open shell and compare with output of
    file <name of file>
  3. thread starter macrumors newbie

    Jun 3, 2011

    Are you saying you think this could be a shell script?

    It's not!, what i see on the screen is complete gibberish, not a script.

    So I need to have web storage to show you all a pic? I don't have a web site, so how can I stick a pic up so you can see this gibberish?


  4. Moderator emeritus


    Jul 24, 2002
    You can attach pictures to posts. MacRumors hosts them. Look in the Additional Options box when you reply: the Manage Attachments opens a new window that you can use to upload pictures. Take note of the max file sizes though...
  5. thread starter macrumors newbie

    Jun 3, 2011

    here is the gibberish....

    Has anyone seen this?

    Attached Files:

  6. macrumors G4


    Jun 6, 2003
    Solon, OH
    That's an encoding problem for sure. The tip mentioned above using the file command in Terminal will help diagnose the cause.
  7. macrumors 604

    Aug 9, 2009
    Skipping the inverted question marks, what's left looks like normal text. This suggests the inverted question marks are 0x00 bytes, which would be the high byte of a Unicode UTF-16-BE or UTF-16-LE encoding. The two other characters before the first / are probably the byte-order mark (BOM).

    So somewhere or other, Xcode was probably told to use UTF-16.
  8. thread starter macrumors newbie

    Jun 3, 2011
    Got it... FIXED

    Thanks All, you guys were all over this!

    The fix was Xcode/preferences/Text Editing/Default File Encoding:
    was set to UTF - 16 I just set it to UTF -8 and BANG! was fixed.

    Thanks again,


Share This Page