void CChatView::ShowMemoryHtml() { // show all stuff of HTML if it's already stored SetTitle(NULL); SetCharset( NULL); PutBodyContent(NULL); }
P4ClientAPI::P4ClientAPI( lua_State *L ) : L( L ) , specMgr( L ) , ui( L, &specMgr ) { debug = 0; server2 = 0; depth = 0; exceptionLevel = 2; maxResults = 0; maxScanRows = 0; maxLockTime = 0; prog = "unnamed p4lua script"; apiLevel = atoi( P4Tag::l_client ); enviro = new Enviro; // cb.client = this; InitFlags(); // Enable form parsing client.SetProtocol( "specstring", "" ); // // Load the current working directory, and any P4CONFIG file in place // HostEnv henv; StrBuf cwd; henv.GetCwd( cwd, enviro ); if( cwd.Length() ) enviro->Config( cwd ); // // Load the current ticket file. Start with the default, and then // override it if P4TICKETS is set. // const char *t; henv.GetTicketFile( ticketFile ); if( t = enviro->Get( "P4TICKETS" ) ) { ticketFile = t; } // // Do the same for P4CHARSET // const char *lc; if( ( lc = enviro->Get( "P4CHARSET" )) ) { SetCharset(lc); } }
bool MessageData::LoadFromMessage(const String &fileName, shared_ptr<Message> pMessage) { m_pMessage = pMessage; _messageFileName = fileName; m_pMimeMail = shared_ptr<MimeBody>(new MimeBody); const int MaxSize = 1024*1024 * 80; // we'll ignore messages larger than 80MB. if (FileUtilities::FileSize(_messageFileName) > MaxSize) return false; bool bNewMessage = false; try { if (!m_pMimeMail->LoadFromFile(_messageFileName)) { bNewMessage = true; } } catch (...) { try { String sFileNameExclPath = FileUtilities::GetFileNameFromFullPath(_messageFileName); String sMessageBackupPath = IniFileSettings::Instance()->GetLogDirectory() + "\\Problematic messages\\" + sFileNameExclPath; FileUtilities::Copy(_messageFileName, sMessageBackupPath, true); String sErrorMessage; sErrorMessage.Format(_T("An unknown error occurred while loading message. File: %s. Backuped to: %s"), _messageFileName, sMessageBackupPath); ErrorManager::Instance()->ReportError(ErrorManager::Medium, 4218, "MessageData::LoadFromMessage", sErrorMessage); } catch (...) { ErrorManager::Instance()->ReportError(ErrorManager::Medium, 4218, "MessageData::LoadFromMessage", "An unknown error occurred while loading message."); } return false; } if (bNewMessage) { // For new messages, we default to UTF-8. This way client // can put any values into headers without having to care // about setting the correct character set first. SetCharset("utf-8"); SetFieldValue(CMimeConst::MimeVersion(), "1.0"); } return true; }
P4ClientApi::P4ClientApi( lua_State *L ) : L( L ) , specMgr( L ) , ui( L, &specMgr ) , keepAliveRef( LUA_NOREF ) { initCount = 0; debug = 0; server2 = 0; depth = 0; exceptionLevel = 2; maxResults = 0; maxScanRows = 0; maxLockTime = 0; apiLevel = atoi( P4Tag::l_client ); enviro = new Enviro; prog = "unnamed p4lua script"; cb.client = this; // Enable form parsing, and set tagged mode on by default mode |= M_PARSE_FORMS + M_TAGGED ; client.SetProtocol( "specstring", "" ); // // Load any P4CONFIG file // HostEnv henv; StrBuf cwd; henv.GetCwd( cwd, enviro ); if( cwd.Length() ) enviro->Config( cwd ); // // Load the current ticket file. Start with the default, and then // override it if P4TICKETS is set. // const char *t; henv.GetTicketFile( ticketFile ); if( t = enviro->Get( "P4TICKETS" ) ) ticketFile = t; // // Load the current P4CHARSET if set. // if( client.GetCharset().Length() ) SetCharset( client.GetCharset().Text() ); }
nsresult nsCollation::UnicodeToChar(const nsAString& aSrc, char** dst) { NS_ENSURE_ARG_POINTER(dst); nsresult res = NS_OK; if (!mEncoder) res = SetCharset("ISO-8859-1"); if (NS_SUCCEEDED(res)) { const nsPromiseFlatString& src = PromiseFlatString(aSrc); const char16_t *unichars = src.get(); int32_t unicharLength = src.Length(); int32_t dstLength; res = mEncoder->GetMaxLength(unichars, unicharLength, &dstLength); if (NS_SUCCEEDED(res)) { int32_t bufLength = dstLength + 1 + 32; // extra 32 bytes for Finish() call *dst = (char *) PR_Malloc(bufLength); if (*dst) { **dst = '\0'; res = mEncoder->Convert(unichars, &unicharLength, *dst, &dstLength); if (NS_SUCCEEDED(res) || (NS_ERROR_UENC_NOMAPPING == res)) { // Finishes the conversion. The converter has the possibility to write some // extra data and flush its final state. int32_t finishLength = bufLength - dstLength; // remaining unused buffer length if (finishLength > 0) { res = mEncoder->Finish((*dst + dstLength), &finishLength); if (NS_SUCCEEDED(res)) { (*dst)[dstLength + finishLength] = '\0'; } } } if (NS_FAILED(res)) { PR_Free(*dst); *dst = nullptr; } } else { res = NS_ERROR_OUT_OF_MEMORY; } } } return res; }
void IMapInfoFile::SetEncoding( const char* pszEncoding ) { SetCharset( EncodingToCharset( pszEncoding ) ); }