-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
if user has been selected persian or arabic language from settings of the device, the video cache will not work because of arabic/persian digits in pingUrl:
Logcat:
Open connection to http://127.0.0.1:۴۲۵۸۹/ping
Error reading ping response
com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:۴۲۵۸۹/ping with offset 0
i just solved the problem by adding a method in HttpProxyCacheServer.java:
Here is Codes:
String pingUrl = appendToProxyUrl(PING_REQUEST);
String CorrectpingUrl = convertToEnglishDigits(pingUrl);
HttpUrlSource source = new HttpUrlSource(CorrectpingUrl);
and here is the convertToEnglishDigits method code:
public static String convertToEnglishDigits(String value)
{
String newValue = value.replace("١", "1").replace("٢", "2").replace("٣", "3").replace("٤", "4").replace("٥", "5")
.replace("٦", "6").replace( "٧","7").replace("٨", "8").replace("٩", "9").replace("٠", "0")
.replace("۱", "1").replace("۲", "2").replace("۳", "3").replace("۴", "4").replace("۵", "5")
.replace("۶", "6").replace("۷", "7").replace("۸", "8").replace("۹", "9").replace("۰", "0");
return newValue;
}