[android] Fixed wrong encoding for Russian text in bookmarks description

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2021-07-31 12:18:36 +02:00 committed by Roman Tsisyk
parent 72657b60df
commit a42bd76b27
2 changed files with 6 additions and 6 deletions

View file

@ -13,12 +13,12 @@ import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.util.Linkify;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -333,7 +333,9 @@ public class PlacePageView extends NestedScrollViewClickFixed
mBookmarkFrame = findViewById(R.id.bookmark_frame);
mWvBookmarkNote = mBookmarkFrame.findViewById(R.id.wv__bookmark_notes);
mWvBookmarkNote.getSettings().setJavaScriptEnabled(false);
final WebSettings settings = mWvBookmarkNote.getSettings();
settings.setJavaScriptEnabled(false);
settings.setDefaultTextEncodingName("utf-8");
mTvBookmarkNote = mBookmarkFrame.findViewById(R.id.tv__bookmark_notes);
initEditMapObjectBtn();
@ -934,8 +936,7 @@ public class PlacePageView extends NestedScrollViewClickFixed
if (StringUtils.nativeIsHtml(notes))
{
String base64version = Base64.encodeToString(notes.getBytes(), Base64.DEFAULT);
mWvBookmarkNote.loadData(base64version, Utils.TEXT_HTML, Utils.BASE_64);
mWvBookmarkNote.loadData(notes, Utils.TEXT_HTML, Utils.UTF_8);
UiUtils.show(mWvBookmarkNote);
UiUtils.hide(mTvBookmarkNote);
}

View file

@ -56,8 +56,7 @@ public class Utils
@StringRes
public static final int INVALID_ID = 0;
public static final String UTF_8 = "utf-8";
public static final String BASE_64 = "base64";
public static final String TEXT_HTML = "text/html;";
public static final String TEXT_HTML = "text/html; charset=utf-8";
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = "Utils";