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
-
- VIP Member
- Posts: 147
- Joined: 5 Dec 2012 7:29
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 : 㼿㼿㼿㼿㼿㼿㼨㼿㼿㼿㼿㼿㼿㼨⠿㼿弿㼿⠿㼿㼩‬‿㼿㼿弿㼨㼿㼨㼿㼿㼿⤩⤩Ⱐ㼿㽟㼿㼨㼿㼿⤬‿㼿㼿㼿㼿㼿㼿⠿㼿弿㼿⠿㼿㼩⤩
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 : 㼿㼿㼿㼿㼿㼿㼨㼿㼿㼿㼿㼿㼿㼨⠿㼿弿㼿⠿㼿㼩‬‿㼿㼿弿㼨㼿㼨㼿㼿㼿⤩⤩Ⱐ㼿㽟㼿㼨㼿㼿⤬‿㼿㼿㼿㼿㼿㼿⠿㼿弿㼿⠿㼿㼩⤩
Prolog
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
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 )
Prolog
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
Hi,
Look in codePageId.pro (in pfc\codePageId package), you've some code about arabic...
This code work fine in my machine :
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))),
F:write(Txt),
F:close(),
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
ERROR: C:/...../infile_parse.pro:1:
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
ERROR: C:/...../infile_parse.pro:1:
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
Prolog
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
- Thomas Linder Puls
- VIP Member
- Posts: 1424
- Joined: 28 Feb 2000 0:01
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:
It could look like you expect utf16 encoding. This will write the text to an utf16 encoded file:
Which program do you use for determining how "it looks in the file"?clauses
run() :-
S = "For the predicate i would to save : الجملةالمفيدة(الجملةالفعلية((فعل_أمر(اكتب) , مفعول_به(اسم(الدرسَ)))), حرف_عطف(ثمَّ), الجملةالفعلية(فعل_أمر(العب))) // it's in arabic",
O = outputStream_file::create("arab.txt"),
O:write(S),
O:close().
Regards Thomas Linder Puls
PDC
PDC