-------- Mensaje Original --------
Asunto: Re: [Apertium-stuff] Regarding Coding challenge of 1.3 of GSOC idea
Fecha: 2019-03-26 17:40
De: shashank tiwari <shashanktwr...@gmail.com>
Destinatario: Francis Tyers <fty...@prompsit.com>

Dear francis,
     I have finished the coding challenge successfully. The issue is
where it asks us for to make lttoolbox fully unicode compliant. I cannot
understand that. Any help would be appreciated

On Tue, 26 Mar 2019, 23:08 Francis Tyers, <fty...@prompsit.com> wrote:

El 2019-03-17 08:09, shashank tiwari escribió:
I have an issue regarding it that while i can read the unicode data
if
it is in file but when it is in terminal it can't read the unicode
data here is the code i created

#include <iostream>
#include <locale>
#include <string_view>

int main()
{
std::locale user("");
std::locale unicode("en_US.UTF8");
const auto str = std::string(u8"This! Is a tešt тест ** %
test.");

auto & decoder = std::use_facet<std::codecvt<wchar_t, char,
std::mbstate_t>>(unicode);
auto & encoder = std::use_facet<std::codecvt<wchar_t, char,
std::mbstate_t>>(user);

auto inmb = std::mbstate_t();
auto outmb = std::mbstate_t();
auto * next = str.data();
const auto * endptr = str.data() + str.size();
for (auto * ptr = str.data(); ptr < endptr; ptr = next)
{
wchar_t value;
wchar_t * unusedA;
decoder.in [1] [1](inmb, ptr, endptr, next, &value, &value +
1,
unusedA);

char buffer[4];
char * endbuffer;
const wchar_t * unusedB;
encoder.out(outmb, &value, &value + 1, unusedB, &buffer[0],
&buffer[4], endbuffer);

std::cout <<std::string_view(buffer, endbuffer-buffer)
<<" : "
<<std::boolalpha <<std::isalpha(value, unicode)
<<std::endl;
}
return 0;
}

Any suggestions would be appreciated :)


Check your locale ?

F.


Links:
------
[1] http://decoder.in


_______________________________________________
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to