add a q_encode(...) method to misc
This commit is contained in:
parent
140b4495df
commit
1c850b12ec
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2023, Tomasz Sowa
|
* Copyright (c) 2008-2024, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -1074,6 +1074,26 @@ void prepare_cookie_string(
|
||||||
bool secure = false);
|
bool secure = false);
|
||||||
|
|
||||||
|
|
||||||
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
|
void q_encode(
|
||||||
|
const pt::TextStreamBase<char_type, stack_size, heap_block_size> & in,
|
||||||
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
|
bool clear = true)
|
||||||
|
{
|
||||||
|
if( clear )
|
||||||
|
out.clear();
|
||||||
|
|
||||||
|
out << "=?UTF-8?Q?";
|
||||||
|
|
||||||
|
// do not use QEncode(in.c_str()) as 'in' can have a null-terminating byte
|
||||||
|
typename pt::TextStreamBase<char_type, stack_size, heap_block_size>::const_iterator i = in.begin();
|
||||||
|
|
||||||
|
for( ; i != in.end() ; ++i)
|
||||||
|
QEncodeAddChar(*i, out);
|
||||||
|
|
||||||
|
out << "?=";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Winix
|
} // namespace Winix
|
||||||
|
|
Loading…
Reference in New Issue