Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Although the moon is smaller than the earth, it is farther away.


devel / comp.lang.xharbour / Re: hb_UTF8ToStr

SubjectAuthor
* hb_UTF8ToStrMarco Boschi
`* Re: hb_UTF8ToStrDan
 `- Re: hb_UTF8ToStrMarco Boschi

1
hb_UTF8ToStr

<9b47f0a6-a093-4c56-bda8-4e7ca10a1f66n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17035&group=comp.lang.xharbour#17035

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a05:600c:3d8d:b0:39c:5232:107a with SMTP id bi13-20020a05600c3d8d00b0039c5232107amr34995495wmb.191.1655726500139;
Mon, 20 Jun 2022 05:01:40 -0700 (PDT)
X-Received: by 2002:a05:6214:524a:b0:464:6bed:d008 with SMTP id
kf10-20020a056214524a00b004646bedd008mr18466450qvb.69.1655726499687; Mon, 20
Jun 2022 05:01:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Mon, 20 Jun 2022 05:01:39 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=185.55.90.130; posting-account=_oyAawkAAAAkDmcMkD9UQrwxJqiaol5l
NNTP-Posting-Host: 185.55.90.130
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9b47f0a6-a093-4c56-bda8-4e7ca10a1f66n@googlegroups.com>
Subject: hb_UTF8ToStr
From: info@marcoboschi.it (Marco Boschi)
Injection-Date: Mon, 20 Jun 2022 12:01:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Marco Boschi - Mon, 20 Jun 2022 12:01 UTC

Hi to all!
I have a program that import into my application some xml files.
Some times I find some strange characters in example I find in my program (console) somethinks like

"Caffè Grande Italia"
and not
"Caffè Grande Italia"

I presume that the function hb_UTF8ToStr resolves this problem because I have some test in a xml file. The question is
What appens if I change a string with hb_UTF8ToStr if is not needed ?(the files is already ansi mode). Does exist a function that tll to me if a file us utf-8 or not?

many thanks to all
marco

Re: hb_UTF8ToStr

<t8pnr6$vbk$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17036&group=comp.lang.xharbour#17036

  copy link   Newsgroups: comp.lang.xharbour
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: webmaster@appliserver.com (Dan)
Newsgroups: comp.lang.xharbour
Subject: Re: hb_UTF8ToStr
Date: Mon, 20 Jun 2022 14:05:57 +0200
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <t8pnr6$vbk$1@dont-email.me>
References: <9b47f0a6-a093-4c56-bda8-4e7ca10a1f66n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 20 Jun 2022 12:05:58 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b8a71e1c2d391e1156b7e24b4dac8b02";
logging-data="32116"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+B+bQOMWCBRkEQPBU/BbZR"
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:8J0UhIClWnobJIEpSoSBx8iP4zY=
In-Reply-To: <9b47f0a6-a093-4c56-bda8-4e7ca10a1f66n@googlegroups.com>
 by: Dan - Mon, 20 Jun 2022 12:05 UTC

Il 20/06/2022 14:01, Marco Boschi ha scritto:
> Hi to all!
> I have a program that import into my application some xml files.
> Some times I find some strange characters in example I find in my program (console) somethinks like
>
> "Caffè Grande Italia"
> and not
> "Caffè Grande Italia"
>
>
> I presume that the function hb_UTF8ToStr resolves this problem because I have some test in a xml file. The question is
> What appens if I change a string with hb_UTF8ToStr if is not needed ?(the files is already ansi mode). Does exist a function that tll to me if a file us utf-8 or not?
>
>
> many thanks to all
> marco

A couple of C functions easy to implement:

HB_FUNC ( IS_ANSI )
{ LPBYTE pString = ( LPBYTE ) hb_parc( 1 );
WORD w = 0, wLen = hb_parclen( 1 );
BOOL bAnsi = FALSE;

while( w < wLen && ! bAnsi )
{
bAnsi = pString[ w ] >= 224 && pString[ w ] <= 255;
w++;
}

hb_retl( bAnsi );
}

HB_FUNC ( IS_OEM )
{ LPBYTE pString = ( LPBYTE ) hb_parc( 1 );
WORD w = 0, wLen = hb_parclen( 1 );
BOOL bOem = FALSE;

while( w < wLen && ! bOem )
{
bOem = pString[ w ] >= 128 && pString[ w ] <= 168;
w++;
}

hb_retl( bOem );
}

HTH
Dan

Re: hb_UTF8ToStr

<1219ed1e-9347-4192-8414-355a7fcf9ffen@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17037&group=comp.lang.xharbour#17037

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a05:6000:1251:b0:21a:efae:6cbe with SMTP id j17-20020a056000125100b0021aefae6cbemr20412696wrx.281.1655800580218;
Tue, 21 Jun 2022 01:36:20 -0700 (PDT)
X-Received: by 2002:a05:622a:c:b0:306:7748:180 with SMTP id
x12-20020a05622a000c00b0030677480180mr23097715qtw.362.1655800579716; Tue, 21
Jun 2022 01:36:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 21 Jun 2022 01:36:19 -0700 (PDT)
In-Reply-To: <t8pnr6$vbk$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=185.55.90.130; posting-account=_oyAawkAAAAkDmcMkD9UQrwxJqiaol5l
NNTP-Posting-Host: 185.55.90.130
References: <9b47f0a6-a093-4c56-bda8-4e7ca10a1f66n@googlegroups.com> <t8pnr6$vbk$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1219ed1e-9347-4192-8414-355a7fcf9ffen@googlegroups.com>
Subject: Re: hb_UTF8ToStr
From: info@marcoboschi.it (Marco Boschi)
Injection-Date: Tue, 21 Jun 2022 08:36:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Marco Boschi - Tue, 21 Jun 2022 08:36 UTC

Il giorno lunedì 20 giugno 2022 alle 14:06:00 UTC+2 Dan ha scritto:
> Il 20/06/2022 14:01, Marco Boschi ha scritto:
> > Hi to all!
> > I have a program that import into my application some xml files.
> > Some times I find some strange characters in example I find in my program (console) somethinks like
> >
> > "Caffè Grande Italia"
> > and not
> > "Caffè Grande Italia"
> >
> >
> > I presume that the function hb_UTF8ToStr resolves this problem because I have some test in a xml file. The question is
> > What appens if I change a string with hb_UTF8ToStr if is not needed ?(the files is already ansi mode). Does exist a function that tll to me if a file us utf-8 or not?
> >
> >
> > many thanks to all
> > marco
> A couple of C functions easy to implement:
>
> HB_FUNC ( IS_ANSI )
> {
> LPBYTE pString = ( LPBYTE ) hb_parc( 1 );
> WORD w = 0, wLen = hb_parclen( 1 );
> BOOL bAnsi = FALSE;
>
> while( w < wLen && ! bAnsi )
> {
> bAnsi = pString[ w ] >= 224 && pString[ w ] <= 255;
> w++;
> }
>
> hb_retl( bAnsi );
> }
>
> HB_FUNC ( IS_OEM )
> {
> LPBYTE pString = ( LPBYTE ) hb_parc( 1 );
> WORD w = 0, wLen = hb_parclen( 1 );
> BOOL bOem = FALSE;
>
> while( w < wLen && ! bOem )
> {
> bOem = pString[ w ] >= 128 && pString[ w ] <= 168;
> w++;
> }
>
> hb_retl( bOem );
> }
>
> HTH
> Dan
Many Thanks Dan

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor