Opened 6 years ago

Closed 6 years ago

#73 closed defect (fixed)

sources contain non ascii characters

Reported by: Thomas Bernard Owned by: PulkoMandy
Priority: minor Milestone: 2.6
Component: GrafX2 Version: 2.5
Keywords: Cc:

Description

there are 8bit chars in the comments, that should be removed as we translate the comments to english :)

but also in the code.

./const.h:82:34: note: expanded from macro 'ELLIPSIS_CHARACTER'
#define ELLIPSIS_CHARACTER       '<85>'
                                 ^
buttons.c:3893:46: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
  Window_set_normal_button( 58, 46, 37,14,"90<B0>"             ,0,1,Config_Key[SPECIAL_ROTATE_90][0]); // 4
                                             ^~~~

to avoid problem with encoding of source files, we should replace theses non ASCII characters in litterals by \x85 (hexadecimal) or \205 (octal)

I will make a script able to do that

Change History (11)

comment:1 by yrizoud@…, 6 years ago

Worst case scenario is people not seeing the right character when they read the source, but so far nobody has had any issue compiling and getting an executable with the right result.
Note that you will see most non-ascii characters in helpfile.h : References to Bézier curves, people credited...

comment:2 by Thomas Bernard, 6 years ago

yep the issue is that gitlab is expecting UTF8 sources...

Apple LLVM version 8.1.0 (clang-802.0.42) complains :

brush_ops.c:929:32: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
      Print_in_menu("Angle:   0<B0>    ",0);
                               ^~~~

comment:3 by PulkoMandy, 6 years ago

Milestone: 2.52.6

comment:4 by PulkoMandy, 6 years ago

utf-8 makes sense, but is not really an option for GrafX2 UI for now. Let's convert these to \xB0 or the like. It should be possible to write a tr or sed script for this?

comment:5 by Thomas Bernard, 6 years ago

I have already done it... (in python)

When I talk about utf-8 sources, I'm talking about the COMMENTS.
That's dangerous to have any 8bit character in the actual sources. (except comments)

comment:6 by PulkoMandy, 6 years ago

Well, even in comments it's dangerous (or at least annoying) to have anything else than utf8. SVN used to be able to store and handle file encoding, but git doesn't care. Sorry for people trying to port GrafX2 to EBCDIC based platforms! :o)

comment:7 by Thomas Bernard, 6 years ago

git stores 8bits characters and doesn't care about the encoding.
I don't call messing up the comments "dangerous" as it is only a display problem ;)

My plan is :
1) convert all 8 bits chars inside C strings to escaped sequences \123 or \xab. So all C source are pure 7bit ASCII
2) convert sources to utf8 (that is what gitlab and most code source editors expect)

comment:9 by Thomas Bernard, 6 years ago

Fun fact : op_c.c has some comments encoded in "Latin1" (Aka Windows CP1252)
but also some others in IBM437. From the MS-DOS days I guess ;)

comment:10 by PulkoMandy, 6 years ago

Owner: changed from pulkomandy to PulkoMandy
Status: newassigned
Note: See TracTickets for help on using tickets.