2017-04-26 45 views
0

如何在exif文件中添加西里爾文符號? 我的代碼alwais添加了符號「?」。 此代碼:Android如何在exif文件中添加西里爾文符號

String userComment = "АБВГДЕЁЖЗИЙКЛСНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; 
exifInterface.setAttribute("UserComment", userComment); 
exifInterface.saveAttributes(); 

String userComment = "АБВГДЕЁЖЗИЙКЛСНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; 
exifInterface.setAttribute("UserComment", new String(userComment.getBytes(), "UTF-8")); 
exifInterface.saveAttributes(); 
+0

不知道是否有可能。你有沒有見過一個帶有西里爾字符的exif信息的jpg文件?如果是這樣,請把它放在網上,並給它一個網址。 – greenapps

+0

你如何檢查結果?隨着你的應用程序或外部應用程序? – greenapps

+0

我在我的應用程序和外部應用程序中檢查了結果。 – user1854307

回答

0

想那ExifInterface類不支持此西里爾。

我試圖讓從標籤字節與

byte [] bytes1 = exifInterface.getAttribute("UserComment").getBytes(); 
    byte [] bytes2 = exifInterface.getAttribute("UserComment").getBytes("utf-8"); 
// byte [] bytes3 = exifInterface.getAttribute("UserComment").getBytes("utf-16"); 
// byte [] bytes3 = exifInterface.getAttribute("UserComment").getBytes("ISO-8859-1"); 
    byte [] bytes3 = exifInterface.getAttribute("UserComment").getBytes("windows-1252"); 

然後以十六進制顯示字節。他們都是垃圾。

對於您的33個字符,共有66個字節。不知道使用哪種編碼。

我想比較他們與您的字母字符串的字節。

也嘗試編譯Andoid 7,但都一樣。

我放棄;-)。

+0

您是否試圖在UserComment中編寫文字? – user1854307

+0

不。如果我不能讀取exif,那麼我不會嘗試寫一個exif。我將如何檢查寫入?只有外部應用程序。 – greenapps

+0

也許您自己錄製的數據可以被讀取。 – user1854307

相關問題