ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 encoding issue EXIF data?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dave.sellers Posted - May 10 2013 : 06:46:10
Hi

ImageEn v4.3.0 Delphi v7

Extracting all the EXIF data from a JPEG I find a spurious character in the Copyright field.

I have attached the sample file:



plus a screen shot of the ImageEn EXIF sample program displaying the spurious character and PhotoMe displaying correctly:



Any suggestions welcome

Regards
Dave
9   L A T E S T    R E P L I E S    (Newest First)
dave.sellers Posted - May 13 2013 : 09:27:04
Hi William

Sadly yes, for this project I'm stuck on D7. It's planned to upgrade to XE2 or higher though unlikely to happen for many (many!) months yet.

Regards
Dave
w2m Posted - May 13 2013 : 06:30:59
When I tested ReinterpUTF8storedInAnsiString with Delphi 2010 the proper copyright was displayed without adding the call to Utf8ToAnsi.

Are you using Delphi 7?

William Miller
fab Posted - May 13 2013 : 03:44:49
This is not a clean, this is an actual conversion from UTF8 to pure ascii. Of course there are side effects (UTF8 has more characters than ascii, and ascii is code page dependent).
dave.sellers Posted - May 11 2013 : 08:58:54
Thanks all.

Well I managed to get that to work with a tiny modification. I added that function to the exif demo program and called it for the Copyright value:

Cells[1, 9] := ReinterpUTF8storedInAnsiString(EXIF_Copyright);

But it still showed the spurious accented A (Â) until I modified the function thus:

function TMainForm.ReinterpUTF8storedInAnsiString(const ansi: AnsiString): string;
var
utf8: UTF8String;
begin
SetLength(utf8, Length(ansi));
Move(Pointer(ansi)^, Pointer(utf8)^, Length(ansi));
//*****Added call to Utf8ToAnsi******
Result := Utf8ToAnsi(utf8);
end;

So I have a workaround but I'm wondering whether this 'fix' should actually take place within the ImageEn code rather than at the application level? Also, could there be any nasty side effects of this workaround if I were to use it to 'cleanse' all EXIF and IPTC values read from files?

Regards
Dave
w2m Posted - May 10 2013 : 09:12:41
If Unicode characters appear in the EXIF can they be removed before loading the EXIF value?

Afer I got some help at StackOverFlow you can use this function to get the string to appear correctly:
function ReinterpUTF8storedInAnsiString(const ansi: AnsiString): string;
var
  utf8: UTF8String;
begin
  SetLength(utf8, Length(ansi));
  Move(Pointer(ansi)^, Pointer(utf8)^, Length(ansi));
  Result := utf8;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
fab Posted - May 10 2013 : 08:37:39
Yes, because ImageEn expects an ascii string, not unicode or utf8.
w2m Posted - May 10 2013 : 08:28:06
Delphi 2010 also shows it too!!!

William Miller
fab Posted - May 10 2013 : 07:48:31
This is the copyright symbol © encoded as UTF-8 sequence (that is 0xc2 and 0xa9).
Delphi 7 shows it as ascii, displaying an "Â" (C2) and a "©" (A9), ignoring that is a UTF8 sequence.
Standing to exif tags the Copyright tag (33432) should be simple ASCII, not UTF8 or unicode. I don't know why there is UTF8 inside this tag.
w2m Posted - May 10 2013 : 07:23:03
Thank you for your report. I have reproduced the described behavior.
Perhaps Nigel or Fabrizio will provide further comment.


William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html