diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d48133b..c8359a95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed folders showing up incorrectly as files in copy/move dialog ([#267]) - Fixed error when saving files with unsupported characters ([#250]) - Fixed missing permission prompt on initial "Save as" launch ([#85]) +- Fixed printing text files containing a "#" ([#104]) ## [1.2.3] - 2025-09-15 ### Fixed @@ -78,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#267]: https://github.com/FossifyOrg/File-Manager/issues/267 [#250]: https://github.com/FossifyOrg/File-Manager/issues/250 [#85]: https://github.com/FossifyOrg/File-Manager/issues/85 +[#104]: https://github.com/FossifyOrg/File-Manager/issues/104 [Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.2.3...HEAD [1.2.3]: https://github.com/FossifyOrg/File-Manager/compare/1.2.2...1.2.3 diff --git a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt index c01aed37..4e7678cf 100644 --- a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt @@ -7,6 +7,7 @@ import android.net.Uri import android.os.Bundle import android.print.PrintAttributes import android.print.PrintManager +import android.util.Base64 import android.view.inputmethod.EditorInfo import android.webkit.WebResourceRequest import android.webkit.WebView @@ -229,7 +230,17 @@ class ReadTextActivity : SimpleActivity() { } } - webView.loadData(binding.readTextView.text.toString(), "text/plain", "UTF-8") + val text = binding.readTextView.text.toString() + ensureBackgroundThread { + try { + val base64 = Base64.encodeToString(text.toByteArray(), Base64.DEFAULT) + runOnUiThread { + webView.loadData(base64, "text/plain", "base64") + } + } catch (e: Exception) { + showErrorToast(e) + } + } } catch (e: Exception) { showErrorToast(e) }