From 557bf9c01fd78848167c1db8327aed259c5b3690 Mon Sep 17 00:00:00 2001 From: stderr64 Date: Tue, 28 Oct 2025 18:11:09 +0200 Subject: Added some stuff --- cpp_unicode_test/stdstring_unicode.cpp | 33 +++++++++++++++++++++++++++++++++ cpp_unicode_test/unicodechars.txt | 1 + cpp_unicode_test/writemisc.pl | 25 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 cpp_unicode_test/stdstring_unicode.cpp create mode 100644 cpp_unicode_test/unicodechars.txt create mode 100755 cpp_unicode_test/writemisc.pl (limited to 'cpp_unicode_test') diff --git a/cpp_unicode_test/stdstring_unicode.cpp b/cpp_unicode_test/stdstring_unicode.cpp new file mode 100644 index 0000000..d60679c --- /dev/null +++ b/cpp_unicode_test/stdstring_unicode.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include + +int main( int argc, char *args[] ){ + unsigned char *fcontents = NULL; + std::fstream *charfile = new std::fstream( reinterpret_cast("./unicodechars.txt"), std::ios::in ); + if ( charfile->fail() ){ + std::cerr << "Failed to open file\n"; + exit( EXIT_FAILURE ); + } + charfile->seekg( 0, std::ios::end ); + ssize_t fsize = static_cast(charfile->tellg()); + charfile->seekg( 0, std::ios::beg ); + fcontents = static_cast(calloc(fsize, sizeof(unsigned char))); + if ( fcontents == NULL ){ + std::cerr << "calloc failed\n"; + exit( EXIT_FAILURE ); + } + charfile->read( reinterpret_cast(fcontents), fsize ); + charfile->close(); + delete charfile; + fsize = 0; + std::string *uchars = new std::string( "" ); + uchars->assign( reinterpret_cast(fcontents) ); + free( fcontents ); + std::cout << uchars->c_str() << "\n"; + delete uchars; + exit( EXIT_SUCCESS ); +} diff --git a/cpp_unicode_test/unicodechars.txt b/cpp_unicode_test/unicodechars.txt new file mode 100644 index 0000000..1012c1d --- /dev/null +++ b/cpp_unicode_test/unicodechars.txt @@ -0,0 +1 @@ +☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌⚍⚎⚏⚐⚑⚒⚓⚔⚕⚖⚗⚘⚙⚚⚛⚜⚝⚞⚟⚠⚡⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯⚰⚱⚲⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼⚽⚾⚿⛀⛁⛂⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌⛍⛎⛏⛐⛑⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛⛜⛝⛞⛟⛠⛡⛢⛣⛤⛥⛦⛧⛨⛩⛪⛫⛬⛭⛮⛯⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾ diff --git a/cpp_unicode_test/writemisc.pl b/cpp_unicode_test/writemisc.pl new file mode 100755 index 0000000..43ba4ec --- /dev/null +++ b/cpp_unicode_test/writemisc.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl +use IO::File; + +my $charcode = 0x2600; + +my $out_string = ""; + +for ( ; $charcode < 0x26FF; $charcode++ ){ + $out_string .= chr( $charcode ); +} + +$out_string .= "\n"; + +undef $charcode; + +open( my $ofile, ">:encoding(UTF-8)", "unicodechars.txt" ) or die "Failed to open file for writing";; + +print( $ofile $out_string ); + +undef $ofile; +undef $out_string; + +print( "Finished writing to file\n" ); + +exit( 0 ); -- cgit v1.2.3-94-g38b9