added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "templates.h"
|
||||
#include "misc.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/misc.h"
|
||||
#include "../core/bbcodeparser.h"
|
||||
|
||||
#include "core/request.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/bbcodeparser.h"
|
||||
#include "core/textstream.h"
|
||||
|
||||
|
||||
|
||||
@@ -68,19 +68,19 @@ void item_content_type_is(Item & item, Info & i)
|
||||
{
|
||||
i.res = false;
|
||||
|
||||
if( item.content_type == Item::ct_text && i.par == "text" )
|
||||
if( item.content_type == Item::ct_text && i.par == L"text" )
|
||||
i.res = true;
|
||||
else
|
||||
if( item.content_type == Item::ct_formatted_text && i.par == "formatted text" )
|
||||
if( item.content_type == Item::ct_formatted_text && i.par == L"formatted text" )
|
||||
i.res = true;
|
||||
else
|
||||
if( item.content_type == Item::ct_html && i.par == "html" )
|
||||
if( item.content_type == Item::ct_html && i.par == L"html" )
|
||||
i.res = true;
|
||||
else
|
||||
if( item.content_type == Item::ct_bbcode && i.par == "bbcode" )
|
||||
if( item.content_type == Item::ct_bbcode && i.par == L"bbcode" )
|
||||
i.res = true;
|
||||
else
|
||||
if( item.content_type == Item::ct_raw && i.par == "raw" )
|
||||
if( item.content_type == Item::ct_raw && i.par == L"raw" )
|
||||
i.res = true;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void item_content_type_is(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void item_print_content(std::ostringstream & out, const std::string & content, Item::ContentType content_type)
|
||||
void item_print_content(TextStream<std::wstring> & out, const std::wstring & content, Item::ContentType content_type)
|
||||
{
|
||||
if( content_type == Item::ct_text )
|
||||
{
|
||||
@@ -110,7 +110,7 @@ void item_print_content(std::ostringstream & out, const std::string & content, I
|
||||
else
|
||||
if( content_type == Item::ct_bbcode )
|
||||
{
|
||||
static std::string out_temp;
|
||||
static std::wstring out_temp;
|
||||
out_temp.clear();
|
||||
out_temp.reserve(content.size()*2);
|
||||
|
||||
@@ -134,7 +134,7 @@ void item_print_content(Info & i)
|
||||
|
||||
void item_privileges(Info & i)
|
||||
{
|
||||
i.out << std::setbase(8) << request->item.privileges << std::setbase(10);
|
||||
i.out << Itoa(request->item.privileges, 8);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,12 +278,12 @@ void item_run(Info & i)
|
||||
}
|
||||
|
||||
Ezc::Pattern * p = pattern_cacher.GetPattern(request->item);
|
||||
std::ostringstream item_run_content;
|
||||
TextStream<std::wstring> item_run_content;
|
||||
|
||||
Ezc::Generator gen(item_run_content, *p, ezc_functions);
|
||||
Ezc::Generator<TextStream<std::wstring> > gen(item_run_content, *p, ezc_functions);
|
||||
gen.Generate();
|
||||
|
||||
item_print_content(i.out, item_run_content.str(), request->item.content_type);
|
||||
item_print_content(i.out, item_run_content.Str(), request->item.content_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ void item_tab_print_content(Info & i)
|
||||
if( item_index >= request->item_tab.size() )
|
||||
return;
|
||||
|
||||
std::string & content = request->item_tab[item_index].content;
|
||||
std::wstring & content = request->item_tab[item_index].content;
|
||||
Item::ContentType type = request->item_tab[item_index].content_type;
|
||||
|
||||
item_print_content(i.out, content, type);
|
||||
@@ -369,7 +369,7 @@ void item_tab_print_content(Info & i)
|
||||
void item_tab_privileges(Info & i)
|
||||
{
|
||||
if( item_index < request->item_tab.size() )
|
||||
i.out << "0" << std::setbase(8) << request->item_tab[item_index].privileges << std::setbase(10);
|
||||
i.out << "0" << Itoa(request->item_tab[item_index].privileges, 8);
|
||||
}
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ void item_tab_dir(Info & i)
|
||||
{
|
||||
if( item_index < request->item_tab.size() )
|
||||
{
|
||||
std::string path;
|
||||
std::wstring path;
|
||||
|
||||
if( system->dirs.MakePath(request->item_tab[item_index].parent_id, path) )
|
||||
HtmlEscape(i.out, path);
|
||||
@@ -551,8 +551,12 @@ void item_tab_run(Info & i)
|
||||
}
|
||||
|
||||
Ezc::Pattern * p = pattern_cacher.GetPattern(request->item_tab[item_index]);
|
||||
Ezc::Generator gen(i.out, *p, ezc_functions);
|
||||
TextStream<std::wstring> item_run_content;
|
||||
|
||||
Ezc::Generator<TextStream<std::wstring> > gen(item_run_content, *p, ezc_functions);
|
||||
gen.Generate();
|
||||
|
||||
item_print_content(i.out, item_run_content.Str(), request->item_tab[item_index].content_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user