Pelles C > Feature requests

UTF-8 Identifiers

<< < (2/2)

Pelle:
Good news: it wasn't too hard adding a new compiler option (/utf-8) that switches from the default ANSI code page (both for runtime, and source files without a BOM). Will be in the next version.

Robert:

--- Quote from: Pelle on February 24, 2021, 05:24:19 PM ---Good news: it wasn't too hard adding a new compiler option (/utf-8) that switches from the default ANSI code page (both for runtime, and source files without a BOM). Will be in the next version.

--- End quote ---

شكرا لك
આભાર
Баярлалаа
Cảm ơn bạn
謝謝
Thank you

Robert:

--- Quote from: Robert on February 24, 2021, 10:08:13 PM ---
--- Quote from: Pelle on February 24, 2021, 05:24:19 PM ---Good news: it wasn't too hard adding a new compiler option (/utf-8) that switches from the default ANSI code page (both for runtime, and source files without a BOM). Will be in the next version.

--- End quote ---

شكرا لك
આભાર
Баярлалаа
Cảm ơn bạn
謝謝
Thank you



--- End quote ---

+1

Use /utf-8 flag on pocc 11.0 compiler command line.


--- Code: ---#include <windows.h>
#include <stdio.h>    // ISO StdLib
#include <stdlib.h>   // ISO StdLib
#include <conio.h>    // Πρωτόγονη είσοδος / έξοδος

// *************************************************
//            Καθολικές μεταβλητές χρηστών
// *************************************************

static int αρχικός_Κώδικας_σελίδα;

// *************************************************
//               Πρωτότυπα χρήστη
// *************************************************

char* Όνομα_μήνα (int);
char* εργάσιμες (int);

// *************************************************
//            Διαδικασίες χρήστη
// *************************************************

char * Όνομα_μήνα (int μετρητής)
{
  static char* στοιχεία[]=
  {

  // The Antikythera mechanism, the oldest example of an analogue computer, has the
  //  following 12 month names of the Corinthian calendar inscribed on the Metonic dial.
  //  https://en.wikipedia.org/wiki/Antikythera_mechanism

 "ΦΟΙΝΙΚΑΙΟΣ","ΚΡΑΝΕΙΟΣ","ΛΑΝΟΤΡΟΠΙΟΣ","ΜΑΧΑΝΕΥΣ",
 "ΔΩΔΕΚΑΤΕΥΣ","ΕΥΚΛΕΙΟΣ","ΑΡΤΕΜΙΣΙΟΣ","ΨΥΔΡΕΥΣ",
 "ΓΑΜΕΙΛΙΟΣ","ΑΓΡΙΑΝΙΟΣ","ΠΑΝΑΜΟΣ","ΑΠΕΛΛΑΙΟΣ"
  };
  if(μετρητής<1||μετρητής>12 )
  {
   return 0;
  }
 return στοιχεία[μετρητής-1];
}

char* εργάσιμες (int μετρητής)
{
  static char* στοιχεία[]=
  {
 "Κυριακή","Δευτέρα","Τρίτη","Τετάρτη",
 "Πέμπτη","Παρασκευή","Σάββατο"
  };
 return στοιχεία[μετρητής-1]; 
}

// *************************************************
//                  Κύριο πρόγραμμα
// *************************************************

  int main(int argc, char *argv[])
{
  αρχικός_Κώδικας_σελίδα=GetConsoleOutputCP();
  SetConsoleOutputCP(65001);
  printf("%s\n","Εδώ είναι τα ονόματα του μήνα:");
  printf("\n");
    {int ιώτα;
  for(ιώτα=1; ιώτα<=12; ιώτα+=1)
    {
      printf("%s\n",Όνομα_μήνα(ιώτα));
    }
    }
  printf("\n");
  printf("%s\n","Εδώ είναι τα ονόματα των ημερών της εβδομάδας:");
  printf("\n");
    {int ιώτα;
  for(ιώτα=1; ιώτα<=7; ιώτα+=1)
    {
      printf("%s\n",εργάσιμες(ιώτα));
    }
    }
  SetConsoleOutputCP(αρχικός_Κώδικας_σελίδα);
    printf("\n%s\n","Πατήστε οποιοδήποτε κουμπί για να συνεχίσετε . . .");
  _getch();
 
  return EXIT_SUCCESS;   // Τέλος του κύριου προγράμματος
}

--- End code ---

Result:


--- Code: ---
Εδώ είναι τα ονόματα του μήνα:

ΦΟΙΝΙΚΑΙΟΣ
ΚΡΑΝΕΙΟΣ
ΛΑΝΟΤΡΟΠΙΟΣ
ΜΑΧΑΝΕΥΣ
ΔΩΔΕΚΑΤΕΥΣ
ΕΥΚΛΕΙΟΣ
ΑΡΤΕΜΙΣΙΟΣ
ΨΥΔΡΕΥΣ
ΓΑΜΕΙΛΙΟΣ
ΑΓΡΙΑΝΙΟΣ
ΠΑΝΑΜΟΣ
ΑΠΕΛΛΑΙΟΣ

Εδώ είναι τα ονόματα των ημερών της εβδομάδας:

Κυριακή
Δευτέρα
Τρίτη
Τετάρτη
Πέμπτη
Παρασκευή
Σάββατο

Πατήστε οποιοδήποτε κουμπί για να συνεχίσετε . . .


--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version