limelect
-
Content Count
779 -
Joined
-
Last visited
-
Days Won
1
Posts posted by limelect
-
-
@Remy LebeauBy the way i have an option not to attach but sending just text ,
the same text. Sending it (not attaching) the Hebrew is OK !!
This is what i use
procedure TForm4.SpeedButton1Click(Sender: TObject);
var
{$IFDEF Android}
Intent: JIntent;
{$ENDIF}begin
Intent := TJIntent.Create;
Intent.setType(StringToJString('text/html/pdf/plain')); // Defines the data string.
Intent.setAction(TJIntent.JavaClass.ACTION_SEND);//ACTION_VIEW); //Defines the Action.
Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringtoJString(Form2.St));
if MainActivity.getPackageManager.queryIntentActivities(Intent, TJPackageManager.JavaClass.MATCH_DEFAULT_ONLY).size > 0 then //Checks if there is at least one application capable of receiving the intent.
MainActivity.startActivity(Intent) //Calls startActivity() to send the intent to the system.
else
ShowMessage('Receiver not found');end;
-
@Remy Lebeau looking into the raw did not help.
The content is
-0000000000009167230597ebd2b6
Content-Type: text/html; charset="UTF-8" << this is OK.
and the attached is
Content-Transfer-Encoding: base64
X-Attachment-Id: 16e9172ed2a2ffb332f1
Content-ID: <16e9172ed2a2ffb332f1>Have you an idea which is the best place to put my problem
for Android. Since it seem to be an Android question.
P.S do not forget that loading the same text not with our
application it is OK.
Did i say crazy? May be an Android bug?
- 1
-
@Maher Tannous For Hebrew I am using the above solution. It works great. changing those 3 files FMX.TextLayout.GPU,
FMX.FontGlyphs and FMX.FontGlyphs.Android.
Since i do not know Arabic i cannot check for it.
What i will do in the future add Arabic K.B and see the connection of characters.
May be some one around me will help with this.
Further on my project see a new problem
-
@Remy Lebeau reading your comment a few times let me think
where in my software should i insert your suggestion?
In Intent.setType some how?
Just found should i try
?
-
@Remy Lebeau It seem to be more profound of a problem not Delphi only.
As i wrote in my last comment i did a small application for Android Studio
based on https://www.javacodegeeks.com/2013/10/send-email-with-attachment-in-android.html
and it has the same problem.
I do not think it is a decoding problem . And why?
Attaching the same text file strait from Gmail application in my phone
and sending it to my computer , text shown OK attach OK.
Using either Delphi or Android Studio applications has this problem. (Using the same Gmail application on the phone).
Viewing the mail received text gibberish attach OK.
It seems that some thing very profound is missing in all programs.
Am i wrong ?
-
In my investigation ,whats going on, i wrote an application
with Android Studio. I loaded my text file and the result
are the same as with Delphi.
So one cannot blame Delphi.
That is the good news the bad is the gibberish.
-
@Lars FosdalThis is what i get from the above demo when i insert HEBREW text
first line of file second line of file second line שלמה ×בייצחק of file
The attached is OK
And what it suppose to be
lines.Add('first line of file');
lines.Add('second line of file');
lines.Add('second line שלמה אבייצחק of file');
^^^^ Hebrew -
@Lars Fosdal In my opinion some thing is not correct the way i am sending the attach and it has nothing
to do with utf-8.
I even used this pas file. same result
https://github.com/roywoll/wwEmailWithAttachment_fmx
Some thing very basic wrong.
-
@Lars Fosdal HTML yes. '<meta charset="utf-8">'
My comments
"BE AWARE THAT LOADING THE SAME FILES WITH GMAIL BOTH FILES (text and html) ARE SHOWN OK."
I am using on the SAME text file once GMAIL and once GMAIL FROM MY application !!!!
That is what bugs me.
GMAIL shows the attached text file. it is crazy. since it is the same file.
-
@Lars Fosdal where in the source there is a place for UTF-8?
Be aware that i am using the SAME GMAIL phone application.
Once from my application and once stand alone application.
-
This my mail attached Delphi software.
procedure TForm4.CreateEmail(const Recipient, Subject, Content, Attachment: string);
var
JRecipient: TJavaObjectArray<JString>;
Intent: JIntent;
Uri: Jnet_Uri;
AttachmentFile: JFile;
begin
JRecipient := TJavaObjectArray<JString>.Create(1);
JRecipient.Items[0] := StringToJString(Recipient);Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_SEND);
Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
Intent.putExtra(TJIntent.JavaClass.EXTRA_EMAIL, JRecipient);
Intent.putExtra(TJIntent.JavaClass.EXTRA_SUBJECT, StringToJString(Subject));
Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringToJString(Content));
Intent.setType(StringToJString('message/rfc822'));
if Attachment <> '' then
begin
AttachmentFile := TJFile.JavaClass.init(StringToJString(Attachment));
Uri := TJnet_Uri.JavaClass.fromFile(AttachmentFile);
Intent.putExtra(TJIntent.JavaClass.EXTRA_STREAM, TJParcelable.Wrap((Uri as ILocalObject).GetObjectID));
end;Intent.setType(StringToJString('vnd.android.cursor.dir/email'));
SharedActivity.startActivity(Intent);
end;Hebrew text
1. Using NORMAL Gamil phone application on attached Hebrew text file. <<<< NO problem
2. Using my Attached function and Gmail application. <<<< Problem
The problem
when sending text file with Gmail one can see the text and the attachment with no problem. !!!!!!!
When sending SAME text file with Delphi software the attachment is OK but the
Hebrew text shown is gibberish.
IF i attach HTML file same problem HTML file OK but it is shown in the main mail
with gibberish for Hebrew.
BE AWARE THAT LOADING THE SAME FILES WITH GMAIL BOTH FILES (text and html) ARE SHOWN OK.
P.S the mail sent is open in windows. I thing it is NOT a problem of Unicode.
Using galaxy s6 phone.
-
The answer was amazingly simple add
<meta charset="utf-8">
-
@stijnsandersAlthough you are right but this problem is a not realy a code but
a fundamental since on S2 it dose not work but on S6 it dose.
I also checked the code on "Kompozer " which shown as good code.
As i said there is some thing that i miss.
I recall there should be some line for Microsoft IEXPLORER ?
I will keep investigating.
-
Using Delphi 10.2.3 ,Web Browser and Hebrew.
I have 2 devices Samsung s6 and s2.
On S6 no problem.
I am generating an HTML.
Hebrew text is gibberish on Samsong S2.
Tried:
1. <meta content="text/html; charset=ISO-8859-1 and 8
2. TStringStream.Create(TEXT, TEncoding.Unicode);
3. '<big style="font-family: Courier;">' + TEXT (tried a few fonts)Going into a Hebrew site with Web Browser NO PROBLEM ! on s2.
Thanks for your help
-
@Rollo62 It is VCL thanks
The component Tlabeledit has some features like
label placing that you have to develop and not just
include one component into the other.
This component is in the Delphi VCL IDE. now a days.
-
In VCL there is a components Tlabeledit
I am looking for a SOURCE for almost the same
in FMX.
Dose any one has a source ?
-
-
@Alexander SviridenkovI do not have Arabic on my keyboard
And i do not know the Alpha.
How ever in Hebrew i can mix with English with no problem
Have a look at the top right corner on the memo
I have abcdeשלמהfgh
"שלמה" is my name in Hebrew
The mix is OK!!!
-
@Alexander SviridenkovI cannot comment on what you wrote since Arabic
is not my native lang.
But in my case i used the source i shown before and it works
even for mixing Hebrew and English.
Can you elaborate on the problem in your case
showing very simple text here.
I using memo and 10.2.3
-
Further investigating it seem that my last statement (not real BIDI) mite
be wrong since
if Char > 3000 then
if ((Char = 3633) or ((Char >= 3635) and (Char <= 3642)) or
((Char >= 3655) and (Char <= 3662))) then
begin
if LastThaiChar = 0 then
LastThaiChar := 3585;
// DoLogInfo(format('Detected new advance from %d + %d',[ FLastThaiChar,char]));
// Advance := FPaint.measureText(StringToJString(System.Char.ConvertFromUtf32(3585)+System.Char.ConvertFromUtf32(Char)));if Char = 3635 then // ׂ
Advance := FPaint.measureText
(StringToJString(System.Char.ConvertFromUtf32(LastThaiChar) +
System.Char.ConvertFromUtf32(Char))) -
FPaint.measureText
(StringToJString(System.Char.ConvertFromUtf32(LastThaiChar)))
elseAdvance := 0;
end;
if Char >= 3585 then
if Char <= 3630 then
LastThaiChar := Char;
since above section has nothing to do with MY !!! Hebrew fonts.
is it useless ???? i do not know.
-
Last thought.
It is still not perfect solution.
As it is not a REAL BIDI. it is specific to Arabic or Hebrew but other
languages do not apply. So it cannot be given to the world.
-
I just put it in my REAL application and it works great.
- 1
-
@Serge_G Thank you for your help
The link in your answer did the TRICK.
I had many weeks of search for the answer
-
@John Kouraklis It works.
I used this link
http://arabteam2000-forum.com/applications/core/interface/file/attachment.php?id=159065
1. with Delphi 10.2.3 i used the berlin version
2. My test project is fmx+memo
3. I added THE 3 pas files
4. i added FMX.Canvas.GPU.pas from the Delphi fmx source
5. I added path of Delphi source fmx to my project
6. compiled
7. apk to my samsung s6 phone
8. DID NOT CHANGE NOTHING IN THE SOURCE !!!!
9. AND IT WORKS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-. in my case it is HEBREW !!
P.S 4 not needed as you have 5
- 1
Hebrew in mail
in FMX
Posted · Edited by limelect
@Remy Lebeau I took your suggestion
I open for edit both mail one with Delphi software the other with google mail.
This is the good mail
Content-Type: text/html; charset="UTF-8"; name="WriteHTML.html"
This is with Delphi attach the bad
Content-Type: application/octet-stream; name="WriteHTML.html"
I tried
Intent.setType(StringToJString('message/rfc822; charset=utf-8'));
or Intent.setType(StringToJString('html ..... or text....
And many other combinations nothing.
I wander if there is a instruction that changes Content beside Intent.setType ?