I implemented this today, will be available in git soon. It's called
WString::setDefaultEncoding.
Add WString::setDefaultEncoding(UTF8); to your main() and Wt will assume
default UTF-8 for C style strings instead of default c++ locale.
Wim.
2013/10/15 Muhammad Nasser Al-Noimi <mnno...@gmail.com>
> WString::setDefaultEncoding() is a good solution, but how I can get it?
> I'm currently using WString("héllö", UTF8); for every string but I prefer
> your suggested solution.
>
> Thanks
>
>
>
> On 14 أكت, 2013 م 04:28, Wim Dumon wrote:
>
> I looked it up for you: QString(const char*c) in Qt4 uses fromAscii(),
> in Qt5 it uses fromUtf8(). Additionally, in Qt4, you could actually set the
> format interpreted by fromAscii() by calling
> QTextCodec::setCodecForCStrings(); in Qt5 this seems no longer possible.
>
> In Wt we historically used the C++ locale for WString's constructor for
> const char *. We have discussed changing the API of WString so that UTF-8
> becomes the default encoding, but that is in fact a breaking API change
> that we will probably save for a major Wt version bump.
>
> The idea is now to add a static WString::setDefaultEncoding(), which
> makes the default encoding application-wide configurable between
> localencoding and utf8. That can be made backward-compatible and allows you
> to switch it to UTF-8 through a single function call in the beginning of
> your application. Good idea?
>
> BR,
> Wim.
>
>
>
>
> 2013/10/14 Muhammad Nasser Al-Noimi <mnno...@gmail.com>
>
>> Thanks a lot. It worked perfectly, but can I get a solution like in Qt
>> applications? in Qt apps I can write a string with no problem in encoding.
>> I don't know what Qt folks did to make this happens but I wish that I can
>> use something like this in Wt.
>>
>>
>> On 14 أكت, 2013 ص 11:37, Wim Dumon wrote:
>>
>> hich is silly for constant strings.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
>> from
>> the latest Intel processors and coprocessors. See abstracts and register >
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register
> >http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> witty-interest mailing
> listwitty-interest@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest