• AVR Freaks

Hot!Illegal character encoding warning.

Author
ReasonX
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2019/09/11 06:29:37
  • Location: 0
  • Status: offline
2019/10/18 09:07:50 (permalink)
0

Illegal character encoding warning.

Hello. Im support big, old project that communicate with external LCD with charset protocol.
PIC18F67J90 with XC8 2.10
 
As character strings excluded to discrete file, they have KOIR-8 encoding. But compiler doesnt like to unfold macro with unknown encoding, it works well, but on compile throws over 200 warnings, that makes debugging critically annoying.
 
So the question is - how can i suppress this warnings:
 
warning: illegal character encoding in string literal [-Winvalid-source-encoding]
sprintf(uart_tx, TEXT_158);
note: expanded from macro 'TEXT_158'
#define TEXT_158 "main.al2.txt=!<CE><C5><D4>!"
post edited by ReasonX - 2019/10/18 09:56:05
#1

10 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18061
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 09:23:28 (permalink)
    0
    You are in the XC8 forum, but your message looks like a GCC one. 
    #2
    du00000001
    Just Some Member
    • Total Posts : 3244
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 09:30:14 (permalink)
    0
    "... expanded from macro 'TEXT_158' ..." meaning the original TEXT_158 holds CHR(0xCE), CHR(0xC5), CHR(0xD4) - with or without the '!' ?
    Although it max seem somewhat funny, octal coding should be accepted within the initializer strings. A bit funny to encode, but should be compatible with virtually anything - provided 8-Bit character encoding is feasible at all.
    ==> #define TEXT_158 ""main.al2.txt=!\316\305\324!"  (IIRC)

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #3
    ReasonX
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2019/09/11 06:29:37
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 09:55:39 (permalink)
    0
    NKurzman
    You are in the XC8 forum, but your message looks like a GCC one. 

     
    Unfortunately, there is no PIC18 GCC compiler =) Ah, sorry im forget to say, im work with PIC18F67J90 with XC8 2.10, but anyway it doesnt matter.
     
    du00000001
    with or without the '!' ? (IIRC)

    "main.al2.txt=!нет!" in original string 
     
    du00000001
    Although it max seem somewhat funny, octal coding should be accepted within the initializer strings. A bit funny to encode, but should be compatible with virtually anything - provided 8-Bit character encoding is feasible at all.
    ==> #define TEXT_158 ""main.al2.txt=!\316\305\324!"  (IIRC)


    Yeah =) Error is gone, but im have 200+ string like:
    "!много непонятных злых русских букв призрак коммунизма берегись!"
    I can write some py-parser to decode it, but if i can just suppress the warnings - i would prefer this way.
    In addition, it will be impossible to edit on the go
     
     
    post edited by ReasonX - 2019/10/18 09:58:22
    #4
    NKurzman
    A Guy on the Net
    • Total Posts : 18061
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 10:16:22 (permalink)
    0
    Assuming you do not fix it some other way.
    XC8 warnings usually have an number.
    That number can be disabled. See the manual.
    In GCC the can be disabled by name.
    #5
    ReasonX
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2019/09/11 06:29:37
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 10:18:06 (permalink)
    0
    NKurzman
    Assuming you do not fix it some other way.
    XC8 warnings usually have an number.
    That number can be disabled. See the manual.
    In GCC the can be disabled by name.

    The problem is that warning havent a number =\.
    #6
    ReasonX
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2019/09/11 06:29:37
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 10:39:11 (permalink)
    0
    Maybe there is a way, to cast macro in uint8 before unfolding? 
    #7
    du00000001
    Just Some Member
    • Total Posts : 3244
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 13:04:35 (permalink)
    0
    The warning has at least got a name: "invalid-source-encoding".
    Have a look into the docs about how to disable a warning by name  :)

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #8
    mlp
    boots too small
    • Total Posts : 825
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 13:13:07 (permalink)
    0
    NKurzman
    You are in the XC8 forum, but your message looks like a GCC one. 

    In C99 mode XC8 uses the Clang front end which is very GCC-ish.
     

    Mark (this opinion available for hire)
    #9
    1and0
    Access is Denied
    • Total Posts : 10005
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 13:18:05 (permalink)
    0
    du00000001
    The warning has at least got a name: "invalid-source-encoding".
    Have a look into the docs about how to disable a warning by name  :)
     

    Just a wild guess ;)


    -W1,-no-invalid-source-encoding
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 18061
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Illegal character encoding warning. 2019/10/18 15:19:55 (permalink)
    0
    mark.pappin
     
    In C99 mode XC8 uses the Clang front end which is very GCC-ish.



    To Bad, it is an Amateurish system.
    Error Numbers are easy to find in the Manual and Google.
    printf() formatted custom messages can not be searched.
    #11
    Jump to:
    © 2019 APG vNext Commercial Version 4.5