diff --git a/lib/layout/edtsave.cpp b/lib/layout/edtsave.cpp index a33a68ffe7ef..bf44a6b70930 100644 --- a/lib/layout/edtsave.cpp +++ b/lib/layout/edtsave.cpp @@ -923,16 +923,29 @@ CEditSaveObject::~CEditSaveObject(){ // Note: hist_ent->title should always = m_pContext->title? // Change "file:///Untitled" into URL // Use the new address if old title == old address - if( 0 != XP_STRCMP(hist_ent->title, XP_GetString(XP_EDIT_NEW_DOC_NAME) ) && + char* utf8_edit_new_doc_name = (char*) + INTL_ConvertLineWithoutAutoDetect( + INTL_CharSetNameToID(INTL_ResourceCharSet()), + CS_UTF8, + (unsigned char*) XP_GetString(XP_EDIT_NEW_DOC_NAME), + XP_STRLEN(XP_GetString(XP_EDIT_NEW_DOC_NAME)) + ); + if( 0 != XP_STRCMP(hist_ent->title, utf8_edit_new_doc_name ) && 0 != XP_STRCMP(hist_ent->title, hist_ent->address) ) { - pTitle = XP_STRDUP(hist_ent->title); + // pTitle = XP_STRDUP(hist_ent->title); + pTitle = (char*)INTL_ConvertLineWithoutAutoDetect( + CS_UTF8, + m_pBuffer->GetRAMCharSetID(), + (unsigned char*) hist_ent->title, + XP_STRLEN(hist_ent->title) + ); } else { pTitle = XP_STRDUP(pDestFileURL); XP_FREE(hist_ent->title); hist_ent->title = XP_STRDUP(pDestFileURL); } - + XP_FREEIF(utf8_edit_new_doc_name); } else { // Use the URL if no Document title pTitle = XP_STRDUP(pDestFileURL); diff --git a/lib/libmisc/shist.c b/lib/libmisc/shist.c index f32fe032e5e1..f1e39a4d04dd 100644 --- a/lib/libmisc/shist.c +++ b/lib/libmisc/shist.c @@ -795,8 +795,14 @@ SHIST_SetTitleOfCurrentDoc( MWContext *context ) if( he ) { - StrAllocCopy( he->title, context->title ); - + /* StrAllocCopy( he->title, context->title ); */ + /* Let's save the History as UTF8 */ + he->title = (char*)INTL_ConvertLineWithoutAutoDetect( + INTL_DefaultWinCharSetID(context), + CS_UTF8, + (unsigned char*) context->title, + XP_STRLEN(context->title) + ); /* * This is the place where we set the title for *global* history hash records * In addition to not making grid cells normal history entries we've added two diff --git a/lib/libmocha/lm_doc.c b/lib/libmocha/lm_doc.c index 37238179ade6..9774b00e627f 100644 --- a/lib/libmocha/lm_doc.c +++ b/lib/libmocha/lm_doc.c @@ -327,7 +327,7 @@ doc_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) /* XXX BUGBUG Need a story for some of these for a layer's document */ case DOC_TITLE: he = SHIST_GetCurrent(&context->hist); - str = lm_LocalEncodingToStr(context, he ? he->title : ""); + str = lm_EncodingToStr(context->mocha_context, CS_UTF8, he ? he->title : ""); LO_UnlockLayout(); break;