UTF-8 decoding error on windows 7 machine

Help
Song Zhang
2012-06-19
2012-12-06
  • Song Zhang
    Song Zhang
    2012-06-19

    I am trying to use FFI the following code from RWH
    --Enum.hs
    {-#  LANGUAGE CPP #-}
    #define N 16
    main = print
    eclipse console will reuturn
    <built-in>:0:4: lexical error (UTF-8 decoding error)
    Failed, modules loaded: none.
    this problem also arises in dos command line.
    need to set LANG environment to C or en_US.UTF-8
    runghc Enum.hs will be fine in commmand but still not fine in eclipse console
    can anyone explain to me a little bit

     
  • JP Moresmau
    JP Moresmau
    2012-06-19

    What are you doing in the console? Just loading the file? What's the file encoding (you can see it in the Eclipse properties for the file. Maybe set it to UTF-8… If the error happens in a doc command, it's not EclipseFP specific…

     
  • Song Zhang
    Song Zhang
    2012-06-19

    runghc Enum.hs
    if LANG is not set I will get decoding error.
    I have set the text file coding in eclipse window -> preference -> workspace to UTF-8 but not work
    I am not sure about the reason when I do FFI with CPP by add {-#  LANGUAGE CPP #-} extension.
    anyway thanks a lot

     
  • JP Moresmau
    JP Moresmau
    2012-06-19

    Mmhh, I'm not sure changing the preference in the workspace will change your file. Make sure you modify your file again so that it gets written in the proper encoding.