[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37633: Column part interpreted wrong in compilation mode
From: |
Bernd Paysan |
Subject: |
bug#37633: Column part interpreted wrong in compilation mode |
Date: |
Sun, 06 Oct 2019 21:22:20 +0200 |
Am Sonntag, 6. Oktober 2019, 21:16:47 CEST schrieb Eli Zaretskii:
> > From: Bernd Paysan <bernd@net2o.de>
> > Cc: anton@mips.complang.tuwien.ac.at, 37633@debbugs.gnu.org
> > Date: Sun, 06 Oct 2019 21:02:14 +0200
> >
> > if the editor mistook a UTF-8 file for an iso8859-1, it will see an
> > UTF-8 string "äöü" (6 bytes UTF-8) as "äöü" (6 bytes iso8859-1).
> > But it's still 6 bytes.
>
> Not inside the Emacs buffer, it isn't.
I created a unicode file:
void main() {
char *b="ha", *c="ho";
printf("test %i", b);
printf("testäöü %i", c);
}
I loaded this into emacs, and reverted the buffer using iso8859-1 coding
(simulating a wrongly detected encoding).
It then looks like this:
void main() {
char *b="ha", *c="ho";
printf("test %i", b);
printf("testäöü %i", c);
}
I compiled it with gcc -Wall test-utf8.c into a compile-mode buffer.
-*- mode: compilation; default-directory: "~/tmp/" -*-
Compilation started at Sun Oct 6 21:18:24
gcc -Wall test-utf.c
test-utf.c:1:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
1 | void main() {
| ^~~~
test-utf.c: In function ‘main’:
test-utf.c:3:2: warning: implicit declaration of function ‘printf’ [-
Wimplicit-function-declaration]
3 | printf("test %i", b);
| ^~~~~~
test-utf.c:3:2: warning: incompatible implicit declaration of built-in
function ‘printf’
test-utf.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
+++ |+#include <stdio.h>
1 | void main() {
test-utf.c:3:16: warning: format ‘%i’ expects argument of type ‘int’, but
argument 2 has type ‘char *’ [-Wformat=]
3 | printf("test %i", b);
| ~^ ~
| | |
| int char *
| %s
test-utf.c:4:22: warning: format ‘%i’ expects argument of type ‘int’, but
argument 2 has type ‘char *’ [-Wformat=]
4 | printf("testäöü %i", c);
| ~^ ~
| | |
| int char *
| %s
Compilation finished at Sun Oct 6 21:18:24
If I click on the test-utf.c:4:22 label, I get exactly where I want to: On the
i of %i.
If I revert this buffer with the correct encoding utf-8-unix, then it still
navigates to the i of %i, so it's all agnostic to whether the encoding
detected was correct or wrong.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/
signature.asc
Description: This is a digitally signed message part.
- bug#37633: Column part interpreted wrong in compilation mode, (continued)
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/05
- bug#37633: Column part interpreted wrong in compilation mode, Eli Zaretskii, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Eli Zaretskii, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/05
- bug#37633: Column part interpreted wrong in compilation mode, Anton Ertl, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Eli Zaretskii, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Eli Zaretskii, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode,
Bernd Paysan <=
- bug#37633: Column part interpreted wrong in compilation mode, Eli Zaretskii, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/06
- bug#37633: Column part interpreted wrong in compilation mode, Anton Ertl, 2019/10/07
bug#37633: Column part interpreted wrong in compilation mode, Bernd Paysan, 2019/10/05