Summary: | SAVE FILE: indicate which chars can't be encoded | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Marcin Kasperski <Marcin.Kasperski> |
Component: | encoding | Assignee: | Christoph Cullmann <christoph> |
Status: | RESOLVED INTENTIONAL | ||
Severity: | wishlist | CC: | jaba, marco |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Marcin Kasperski
2004-09-20 12:17:53 UTC
Ad c) I found finally which character probably caused the problem in my last case: it was ,, (low double quotation mark). IIRC it should be present in iso-8859-2 but I am not sure, nevertheless I woudl really prefer having it converted to " or even (with some warning) to ? than an error forcing me to save in UTF-8 and convert externally. CVS commit by cullmann: change some save file checks BUG: 89866 M +17 -22 katedocument.cpp 1.766 --- kdelibs/kate/part/katedocument.cpp #1.765:1.766 @@ -2690,6 +2690,7 @@ bool KateDocument::saveFile() // we really want to save this file ? // - bool reallySaveIt = !m_buffer->loadingBorked() || (KMessageBox::warningYesNo(widget(), - i18n("This file could not be loaded correctly due to lack of temporary disk space. Saving it could cause data loss.\n\nDo you really want to save it?")) == KMessageBox::Yes); + if (m_buffer->loadingBorked() && (KMessageBox::warningYesNo(widget(), + i18n("This file could not be loaded correctly due to lack of temporary disk space. Saving it could cause data loss.\n\nDo you really want to save it?")) != KMessageBox::Yes)) + return false; if ( !url().isEmpty() ) @@ -2701,13 +2702,13 @@ bool KateDocument::saveFile() if (!isModified()) { - if (!(KMessageBox::warningYesNo(0, - str + i18n("Do you really want to save this unmodified file? You could overwrite changed data in the file on disk.")) == KMessageBox::Yes)) - reallySaveIt = false; + if (KMessageBox::warningYesNo(0, + str + i18n("Do you really want to save this unmodified file? You could overwrite changed data in the file on disk.")) != KMessageBox::Yes) + return false; } else { - if (!(KMessageBox::warningYesNo(0, - str + i18n("Do you really want to save this file? Both your open file and the file on disk were changed. There could be some data lost.")) == KMessageBox::Yes)) - reallySaveIt = false; + if (KMessageBox::warningYesNo(0, + str + i18n("Do you really want to save this file? Both your open file and the file on disk were changed. There could be some data lost.")) != KMessageBox::Yes) + return false; } } @@ -2717,13 +2718,10 @@ bool KateDocument::saveFile() // can we encode it if we want to save it ? // - bool canEncode = true; - - if (reallySaveIt) - canEncode = m_buffer->canEncode (); - - // - // start with worst case, we had no success - // - bool success = false; + if (!m_buffer->canEncode () + && (KMessageBox::warningYesNo(0, + i18n("The selected encoding cannot encode every unicode character in this document. Do you really want to save it? There could be some data lost.")) != KMessageBox::Yes)) + { + return false; + } // remove file from dirwatch @@ -2733,6 +2731,5 @@ bool KateDocument::saveFile() // try to save // - if (reallySaveIt && canEncode) - success = m_buffer->saveFile (m_file); + bool success = m_buffer->saveFile (m_file); // update the md5 digest @@ -2786,7 +2783,5 @@ bool KateDocument::saveFile() // display errors // - if (reallySaveIt && !canEncode) - KMessageBox::error (widget(), i18n ("The document could not be saved, as the selected encoding cannot encode every unicode character in it. If you are unsure of which encoding to use, try UTF-8 or UTF-16.")); - else if (reallySaveIt && !success) + if (!success) KMessageBox::error (widget(), i18n ("The document could not be saved, as it was not possible to write to %1.\n\nCheck that you have write access to this file or that enough disk space is available.").arg(m_url.url())); I am not sure what exactly the patch above does (I suspect it allows me to force the save) but surely it does not one thing for which I'd like to keep this bug open: it does not show WHICH character/characters cause the save problem. So please leave it open for this problem: implementing some way of presentation to let the user know which file characters disallow the conversion (see also point b) in my initial report). I agree. This problem is also caused by microsoft "smart quotes", usually when pasting stuff off the web. Personally, I'd like the option to force these into ASCII. The package called "demoroniser" is good for this. (it's a short perl script) *** Bug 80305 has been marked as a duplicate of this bug. *** *** Bug 104534 has been marked as a duplicate of this bug. *** Dear user, this wish list item is now closed, as it wasn't touched in the last two years and no contributor stepped up to implement it. The Kate/KTextEditor team is very small and we can just try to keep up with fixing bugs. Therefore wishs that show no activity for two years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users. If you want your feature to be implemented, please step up to provide some patch for it. If you think it is really needed, you can reopen your request, but keep in mind, if no new good arguments are made and no people get attracted to help out to implement it, it will expire in two years again. We have a nice website kate-editor.org that provides all the information needed to contribute, please make use of it. For highlighting improvements our user manual shows how to write syntax definition files. Greetings Christoph |