FastCGI vs. ICU RegexMatch
Thilo Hardt <thilo.hardt-tY2AuhBzi+JWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Organization | Resorate.com |
| Message-ID | <[email protected]> |
fastcgi developers,
i have a problem with FastCGI (C++) and RegexMatch of the icu library.
When i try to compile a regex, like the following one, the regex is'nt
working correctly anymore. I know, this is not the ICU mailing list and
i should not bother you with my regex problems, but this one is a bit
strange in combination with FastCGI_Accept():
#include "unicode/unistr.h"
#include "unicode/regex.h"
#include <string>
#include <stdlib.h>
#include "fcgi_stdio.h"
using namespace std;
int main (int argc, char *argv[])
{
RegexMatcher* pRE;
UErrorCode status;
pRE = 0;
status = U_ZERO_ERROR;
int nOptions = UREGEX_UWORD|UREGEX_DOTALL;
while(FCGI_Accept() >= 0)
{
pRE = new RegexMatcher("\\b(\\p{Letter}+?)\\b", nOptions, status);
string sBuffer = "動ゲーム";
string sMatch;
UnicodeString usMatch;
UnicodeString usBuffer = sBuffer.c_str();
pRE->reset( usBuffer );
while( pRE->find())
{
usMatch = pRE->group( 1, m_status );
sMatch = bs_helper::BsHelper::GetStringFromUnicodeString(usMatch);
cout << sMatch << endl;
}
delete pRE;
printf("Content-type: text/html\r\n\r\n");
(...)
}
}
The regex should trench the words (there are two in the buffer "動" and
"ゲーム") and output it with cout.
It works if i run it from console, without cgi.
It won't work if i run it through FastCGI. All environment variables are
set correctly with -initial-env.
A bit more quaint is, it'll work through FastCGI if i change the code
that way:
(...)
int nOptions = UREGEX_UWORD|UREGEX_DOTALL;
pRE = new RegexMatcher("\\b(\\p{Letter}+?)\\b", nOptions, status);
while(FCGI_Accept() >= 0)
{
string sBuffer = "動ゲーム";
(...)
I use mod_fastcgi 2.4.2 for Apache 2. I compile my code on Debian with
g++ 4.2.0
Regards
Thilo
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/