-4

I saw an umlaut 'A' in C for two times. When i open it in Turbo C, i can't find it but when i open it in notepad it shows.Also i saw it in a book (i can't give the source because it is local) and a number 3 that looks like an exponent. Any idea what is this?

edit: i found it. gotoxy(12,8);cout<<"Ã"<<"Ä"<<"Ä"<<"´";
gotoxy(12,9);cout<<"³";
gotoxy(15,6);cout<<"Å"<<"Ä"<<"Ä"<<"¿";

Dars Devs
  • 3
  • 3
  • 4
    It sounds like you are opening the file with different character sets and seeing incorrect characters in one or both. Also, they have no significance in C, so I would guess they were either inside string literals or part of a comment. – Arkku Nov 20 '18 at 01:06
  • ... people still use Turbo C ?? – paddy Nov 20 '18 at 05:05
  • Turbo C uses non-standard symbol tables called "extended ASCII" from the dark DOS days. You aren't actually writing C code but C++. You need to uninstall Turbo C++, burn your source of learning with fire, then download a free, modern C compiler with IDE. For example Codeblocks, which is rather beginner-friendly. – Lundin Nov 20 '18 at 07:53

1 Answers1

0

C char arrays do not have a concept of string encodings. They are just a bunch of bytes in an array ending with \0. You can use wchar_t for unicode support, but is this available for Turbo-C (circa 1988) ??!.

If you want to use UTF-8, ensure you are working with an editor that can handle these types of characters. Failing that there are umlaut characters in the ISO-8859-16 single-octet encoding.

If your editor can't handle UTF-8 directly, you could encode them in binary:

char umlaut_A[3] = { 0xc3, 0x84, 0x00 };   // Ä
char umlaut_a[3] = { 0xc3, 0xa4, 0x00 };   // ä
// ... etc.

One way to find these out is to paste a UTF-8 string into a file, e.g.: Ä ä ö ü. Then use a hex editor to see the numbers in question.

Kingsley
  • 14,398
  • 5
  • 31
  • 53