Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FOXBARCODEQR FOR UNICODE

Status
Not open for further replies.

vie3548

Programmer
Jul 12, 2021
28
AE
hi
i am using foxbarcodeqr to generate qr code, it is working fine for non unicode characters.
but if i passed string with arabic text its printing different characters.
is foxbarcodeqr supports unicode/utf-8 characters?
is there anyone has tried this? pls help.

Thank you.


Elvie


 
Hi sir,

just pass utf8encode routine in QR code image. it will work.
pls check below :

loFbcQ.FullQRCodeImage(utf8encode(cString) ,, , 6 * 33, 1))

function utf8encode(cStrText)
IF TYPE("cStrText")<>"C"
cStrText=""
ENDIF
LOCAL cRetVal As String
cFilen=FORCEEXT(SYS(2015),"txt")
lcFile=ADDBS(SYS(2023))+cFilen
ado=CREATEOBJECT("ADODB.Stream")
ado.Type=2
ado.Charset="utf-8"
ado_Open
ado.WriteText(cStrText)
ado.SaveToFile(lcFile,2) && adSaveCreateOverWrite
ado.Close
cRetVal=FILETOSTR(lcFile)
ERASE &lcFile
RETURN cRetVal
endfunc
 
hi Sir,

create uft8encode.prg then call in QR code (every fields).

in you report_barcode.frx :
change the expression of Ole control to :

poFbc.FullQRCodeImage("Name : "+table_barcode.barcode+"|add1:"+utf8encode(table_barcode.barcode1)
+"|add2:"+utf8encode(table_barcode.barcode2)+"|add3:"+utf8encode(table_barcode.barcode3)
+"phon4:"+utf8encode(table_barcode.barcode3)+"|DATE : " + DTOC(DATE())+"|TIME:"+TIME())


pls check the below.

snip_ssuwvm.jpg


Hope this helps.


Vie
 
Very excellent works fine
Thank you so much
It was great
best regards
[love2]
 
hello dear
I have one last problem with the space between two words
How can I separate them?
Please correct the code
the following

poFbc.FullQRCodeImage(utf8encode('|'+ALLTRIM('مؤسسة جولدن')+('رقم'+utf8encode('1234567899'))))

thank you very much


SPACE_mdik7k.jpg
 
hi Sir,

Glad it worked.
Sorry i didn't get you with space between words.

Regards,
Vie
 
welcome
dear
I mean the space between words
It's done well now I followed previous instructions
thank you very much
[love2]
 
PMFJI

Your last question is simple. What do you get when you do this?

? ALLTRIM('مؤسسة جولدن')+'رقم'

No space between رقم and the rest, right?

Well, if you want a space there, add a space.



Chriss
 
I would also recommend to first put all texts and numbers you need together and finally and only once translate this whole string with utf8encode.

That way you can also see what will be in the barcode, if you check the result of the whole expression.

Chriss
 
welcome
Dear
I succeeded in making the ALL letters Arabic alphabet and they are working fine QR
Thank you very much for your great effort
Special thanks to this forum, which brought together a lot of professional geniuses.
I wish everyone good luck and success
[love2]
 
This was done well. Follow the previous encoding. Spaces work automatically
 
poFbc.FullQRCodeImage(utf8encode("|Cod"+table_barcode.barcode+
"]Name|"+(table_barcode.barcode1)+
"]Date|"+(DTOC(DATE())+(':'+TIME())+
"]Namber:"+(table_barcode.barcode))))
-------------------------------------
Hello
dear
I have a question: Can we print a QR in lines, for example?
Print each line separately. Is there a solution to this problem? Thank you very much
Code: ---------------------
Name: ---------------
Date: ------- Time: -------
Telephone: -------------
 
Yes, use CHR(13)+CHR(10) for linefeeds. Or even simpler, prepare the text in a TEXT ENDTEXT block:

Code:
Text To lcText NOSHOW
Code: ---------------------
Name: ---------------
Date: ------- Time: -------
Telephone: -------------
EndText
The text, including linefeeds is now in lcText.

On top of this easier writing (what you see is what you get) of multiline texts, you can add the feature of textmerge:
Code:
Text To lcText NOSHOW
Code: <<lcCode>>
Name: <<lcName>>
Date: <<Date()>> Time: <<Time()>>
Telephone: <<lcPhone>>
EndText
This can use variables or also fields of a workarea/table/cursor.

You should apply utf8 conversion with lcText = STRCONV(lcText,9). Just do this as a last step when all ansi text is put together,
because if you do this twice the inpt string is already utf8, but will be interpreted as ansi. Which means every utf8 chracter that has 2 or more bytes length will be interpreted as 2 or more ansi characters instead and you get weird output.

So simply at best put everything together you want as barcode and then once do strconv(ansistring,9) to get utf8.


Chriss
 
HELLO
dear
Thank you very much for the reply and more advanced code
Please review and modify the following code
I tried, but I couldn't get it right
Please I hope you make a correct edit place
First: FRX.
poFbc.FullQRCodeImage(utf8encode("Cod:"+table_barcode.barcode+"]Name:"+(table_barcode.barcode1)+"]Date:"+(DTOC(DATE())+('Time:'+TIME())+"Rif:"+allt(STR(table_barcode.barcode2,9,2)+"]Price:"+allt(STR(table_barcode.barcode3,9,2))))))
----
PRG.
function utf8encode(cStrText)
IF TYPE("cStrText")<>"C"
cStrText=""
ENDIF
LOCAL cRetVal As String
cFilen=FORCEEXT(SYS(2015),"txt")
lcFile=ADDBS(SYS(2023))+cFilen
ado=CREATEOBJECT("ADODB.Stream")
ado.Type=2
ado.Charset="utf-8"
ado_Open
ado.WriteText(cStrText)
ado.SaveToFile(lcFile,2) && adSaveCreateOverWrite
ado.Close
cRetVal=FILETOSTR(lcFile)
ERASE &lcFile
RETURN cRetVal
endfunc
---

I hope that each one is in a separate line like the previous example
Code
Name
Date: Time:
Rif
Price
----
This is incorrect printing

Untitled_mbllum.png
 
Why do you make your life as hard as you can by composing the text within the call to create the barcode?

Code:
Local lcText
Text To lcText NOSHOW
Code: <<table_barcode.barcode>>
Name: <<table_barcode.barcode1>>
Date: <<Date()>> Time: <<Time()>>
Rif: <<allt(STR(table_barcode.barcode2,9,2)>>
Price: <<allt(STR(table_barcode.barcode3,9,2))>>
EndText[code]

Then do REPORT FORM...

And within the report print

poFbc.FullQRCodeImage(STRCONV(m.lcText,9))

Note: A report cannot only access report variables but also all local variables the caller has currently defined.

If this doesn't work then please post the error.

Your code couldn't work, as you didn't do as I said added CHR(13)+CHR(10) for linefeeds. So you didn't add linefeeds. How can you expect to get linefeeds, if you don't even try to add them anywhere?

Chriss
 
he,
dear
This code was used in the frx reports ( +CHR(10) )
he is working well
thank you very much
Greetings
 
Hello sir
Thank you very much for the good attention you have a good project
Can you use base64decode with QR I will upload a full demo project
can you help
thank you very much

Hello_t9icgz.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top