Page 1 of 1
Posted: 23 Mar 2015 9:56
Hi i 'm a beginner with prolog, and i have a unicode problem, while i use the function write to write in a file i don't have the out put i want .
ps: the function write has a term argument wich is in arabic,
thank you so much
Posted: 23 Mar 2015 12:02
Meriem, I would understand the problem better if can you provide:-
- the sample Prolog source code you are using
- the sample output are you getting and
- a statement of what were you expecting to get.
Posted: 23 Mar 2015 14:12
Hello, thx for your reply :
For the predicate i would to save : الجملةالمفيدة(الجملةالفعلية((فعل_أمر(اكتب) , مفعول_به(اسم(الدرسَ)))), حرف_عطف(ثمَّ), الجملةالفعلية(فعل_أمر(العب))) // it's in arabic
in the file that i would like to save it, it apears like this : 㼿㼿㼿㼿㼿㼿㼨㼿㼿㼿㼿㼿㼿㼨⠿㼿弿㼿⠿㼿㼩‬‿㼿㼿弿㼨㼿㼨㼿㼿㼿⤩⤩Ⱐ㼿㽟㼿㼨㼿㼿⤬‿㼿㼿㼿㼿㼿㼿⠿㼿弿㼿⠿㼿㼩⤩
Posted: 23 Mar 2015 14:23
Posted: 23 Mar 2015 15:04
hello Tonton Luc , thx for your post i have seen that post to day but the problem is that i don't want to replace caractere by another cause the out put is not a clear caractere ont the saved file, i m searching for a way to encode the function write in prolog to make it compatible with arabic ( i mean it can recognize arabic caracteres )
Posted: 24 Mar 2015 11:04
Look in codePageId.pro
(in pfc\codePageId package), you've some code about arabic...
This code work fine in my machine :
Code: Select all
Txt = "...tape your arabic text here...",
F = outputStream_file::create(@"test_arabic.txt",stream::ansi(core::codepage(codepageId::utf8))),
Posted: 25 Mar 2015 11:23
Hii, thx for your reply i've tried it but it does not function because my Term is a composed term of arabic caracters so i moved from amzi prolog to swi prolog on eclipse but i got this error
writeq/1: I/O error in write on stream <stream>(07B59408) (Encoding cannot represent character)
how can i solve it ?? thx a lot , and sorry for disturbing
Posted: 26 Mar 2015 7:51
Sorry but I can't help you more because I don't know amzi and swi Prolog.
Posted: 26 Mar 2015 10:46
This clearly looks like an encoding problem.
It could look like you expect utf16 encoding. This will write the text to an utf16 encoded file:
S = "For the predicate i would to save : الجملةالمفيدة(الجملةالفعلية((فعل_أمر(اكتب) , مفعول_به(اسم(الدرسَ)))), حرف_عطف(ثمَّ), الجملةالفعلية(فعل_أمر(العب))) // it's in arabic",
O = outputStream_file::create("arab.txt"),
Which program do you use for determining how "it looks in the file"?