diff options
Diffstat (limited to 'utils/segment/spseg.cpp')
-rw-r--r-- | utils/segment/spseg.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp index 905991f..cec5ba2 100644 --- a/utils/segment/spseg.cpp +++ b/utils/segment/spseg.cpp @@ -176,7 +176,9 @@ int main(int argc, char * argv[]){ size_t size = 0; ssize_t read; while( (read = getline(&linebuf, &size, stdin)) != -1 ){ - linebuf[strlen(linebuf) - 1] = '\0'; + if ( '\n' == linebuf[strlen(linebuf) - 1] ) { + linebuf[strlen(linebuf) - 1] = '\0'; + } //check non-ucs2 characters const glong num_of_chars = g_utf8_strlen(linebuf, -1); |