Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Fatherhood.Org

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 63 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  
Linux Knowledge Base and Tutorial: Forums



Linux Tutorial :: View topic - C program to read thai text files
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

C program to read thai text files

 
Post new topic   Reply to topic    Linux Tutorial Forum Index -> How To
View previous topic :: View next topic  
Author Message
koen
Beginner


Joined: Sep 12, 2005
Posts: 224
Location: Belgium

PostPosted: Mon Sep 25, 2006 7:55 pm    Post subject: Reply with quote

I'm not a programmer, although I've written a few lines of C++, and then stricktly Latin characters, ASCII only.
Still, to get you going here are some thoughts.

You say
[quote]It works fine with english files... but fails to work with thai files [/quote]
That's too vague : How do you know it fails ? Because it does not return any output ?
If so, then there are at least 2 possibilities :
1- your program does not recognise thai characters in the files, so it has noithing to return, and just ends without displaying anything
2- your program reads thai from the files but you don't see any output because your program does not know how to draw thai characters on the screen,

You could try to test this, eg by returning a message ("thai text found !") in stead of outputting the thai text.

If it's just an output problem, you probably need to add locale or language support for thai to your C development environment and/or your operating system.

But I can imagine your program has trouble reading / recognising thai characters, as it probably expects plain ASCII characters from the a US /Latin code page.
If the thai in the files your searching is expressed in unicode, you have an additional problem : ASCII is expressed in 8 bits (and thus the C variable type 'char' is 1 byte) - unicode uses 16 bits per character.

How does your program store the text it needs to search ? in a C string - an array of chars ? How does it find strings in the text and compare them ? the functions from string.h may not be suitable to deal with 16 bit characters, and stdio.h may not have the correct functions to read or output thai characters.

You may want to have a investigate "wide streams" (include wchar.h) - these are streams of "wide" (16 bit) characters, as opposed to the normal text streams that you may be using for english text.

Hope this helps you figure out where to go. I think you have a better chance at a thai coders forum ...
Back to top
View user's profile Send private message
koen
Beginner


Joined: Sep 12, 2005
Posts: 224
Location: Belgium

PostPosted: Mon Sep 25, 2006 8:43 pm    Post subject: Reply with quote

And for anyone interested in problems related to computing and non-western alphabets :

http://www.thai-language.com/default.aspx?tab=5#unicode
short intro to thai in unicode and TIS-620 (ASCII) representation

http://www.fedu.uec.ac.jp/ZzzThai/thailang/
a very illustrative article about the thai alphabet and the problems related to representing it on a computer

http://www.linuxjunkies.org/html/Thai-HOWTO.html#ss2.1
e.g. subsection 2.1 : Linux console fonts for Thai language
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Linux Tutorial Forum Index -> How To All times are GMT
Page 1 of 1

 

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001-2007 phpBB Group
  
Show your Support for the Linux Tutorial

Purchase one of the products from our new online shop. For each product you purchase, the Linux Tutorial gets a portion of the proceeds to help keep us going.


Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
The Linux Tutorial welcomes your suggestions and ideas.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.11 Seconds