SF.net SVN: geany: [501] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed Jun 28 19:27:27 UTC 2006
Revision: 501
Author: eht16
Date: 2006-06-28 12:27:19 -0700 (Wed, 28 Jun 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=501&view=rev
Log Message:
-----------
Fixed a small typo.
Skip converting from UTF-8 in UTF-8 when saving.
Show an error messages dialog if the conversion into an encoding failed.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-06-28 15:18:23 UTC (rev 500)
+++ trunk/ChangeLog 2006-06-28 19:27:19 UTC (rev 501)
@@ -2,6 +2,11 @@
* src/utils.c, src/keyfile.c: Fixed weird behaviour of the recent
files list.
+ * src/document.c:
+ Fixed a small typo.
+ Skip converting from UTF-8 in UTF-8 when saving.
+ Show an error messages dialog if the conversion into an encoding
+ failed.
2006-06-27 Enrico Troeger <enrico.troeger at uvena.de>
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2006-06-28 15:18:23 UTC (rev 500)
+++ trunk/src/document.c 2006-06-28 19:27:19 UTC (rev 501)
@@ -607,25 +607,26 @@
data = (gchar*) g_malloc(len);
sci_get_text(doc_list[idx].sci, len, data);
- // save in original encoding
- if (doc_list[idx].encoding != NULL)
+ // save in original encoding , skip when it is already UTF-8)
+ if (doc_list[idx].encoding != NULL && ! utils_strcmp(doc_list[idx].encoding, "UTF-8"))
{
GError *conv_error = NULL;
gchar* conv_file_contents = NULL;
-
+
// try to convert it from UTF-8 to original encoding
conv_file_contents = g_convert(data, -1, doc_list[idx].encoding, "UTF-8",
NULL, NULL, &conv_error);
if (conv_error != NULL)
{
- geany_debug("error while converting the file to its orinial encoding");
- geany_debug("encoding: %s error message: %s)",
- doc_list[idx].encoding, conv_error->message);
- g_free(doc_list[idx].encoding);
- doc_list[idx].encoding = g_strdup("UTF-8");
- msgwin_status_add(_("Error while converting file (%s)."), conv_error->message);
+ dialogs_show_error(
+ _("An error occurred while converting the file from UTF-8 in \"%s\". The file remains unsaved."
+ "\nError message: %s\n"),
+ doc_list[idx].encoding, conv_error->message);
+ geany_debug("encoding error: %s)", conv_error->message);
g_error_free(conv_error);
+ g_free(data);
+ return;
}
else
{
@@ -988,7 +989,7 @@
switch (sci_get_eol_mode(doc_list[idx].sci))
{
case SC_EOL_CRLF: return _("Win (CRLF)"); break;
- case SC_EOL_CR: return _("Max (CR)"); break;
+ case SC_EOL_CR: return _("Mac (CR)"); break;
case SC_EOL_LF:
default: return _("Unix (LF)"); break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list