Dhaval2404 / ImagePicker

📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera
Apache License 2.0
1.52k stars 339 forks source link

App crash in Arabic Languages #328

Open Prince115 opened 1 year ago

Prince115 commented 1 year ago

Hi,

I am using this library to upload images using camera and gallery.

I am facing issue while Arabic is default language for mobile and upload or capture the image using app.

So anyone have any solution please guide me to resolve the issue.

Thanks in advance

ratheeshcn commented 1 year ago

@Prince115 I think this is because of the image file name on arbic locale, the library have a method to get the timestamp using device default so it could returns the time timestamp in arabic and it really not supported as a valid filename.

private fun getTimestamp(): String { val timeFormat = "yyyyMMdd_HHmmssSSS" return SimpleDateFormat(timeFormat, Locale.getDefault()).format(Date()) }

solution is change it to US locale

private fun getTimestamp(): String { val timeFormat = "yyyyMMdd_HHmmssSSS" return SimpleDateFormat(timeFormat, Locale.US).format(Date()) }