unicode problem

Discussions related to Visual Prolog
meriem
Posts: 4
Joined: 23 Mar 2015 9:26

unicode problem

Unread post by meriem » 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

Peter Muraya
VIP Member
Posts: 146
Joined: 5 Dec 2012 7:29

Unread post by Peter Muraya » 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.
Mutall Data Management Technical Support

meriem
Posts: 4
Joined: 23 Mar 2015 9:26

Unread post by meriem » 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 : 㼿㼿㼿㼿㼿㼿㼨㼿㼿㼿㼿㼿㼿㼨⠿㼿弿㼿⠿㼿㼩‬‿㼿㼿弿㼨㼿㼨㼿㼿㼿⤩⤩Ⱐ㼿㽟㼿㼨㼿㼿⤬‿㼿㼿㼿㼿㼿㼿⠿㼿弿㼿⠿㼿㼩⤩
Prolog

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 23 Mar 2015 14:23


meriem
Posts: 4
Joined: 23 Mar 2015 9:26

Unread post by meriem » 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 )
Prolog

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 24 Mar 2015 11:04

Hi,

:idea: 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(),

meriem
Posts: 4
Joined: 23 Mar 2015 9:26

Unread post by meriem » 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

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

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 26 Mar 2015 7:51

Hi,

Sorry but I can't help you more because I don't know amzi and swi Prolog.
:cry:

User avatar
Thomas Linder Puls
VIP Member
Posts: 1622
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 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:
clauses
run() :-
S = "For the predicate i would to save : &#1575;&#1604;&#1580;&#1605;&#1604;&#1577;&#1575;&#1604;&#1605;&#1601;&#1610;&#1583;&#1577;(&#1575;&#1604;&#1580;&#1605;&#1604;&#1577;&#1575;&#1604;&#1601;&#1593;&#1604;&#1610;&#1577;((&#1601;&#1593;&#1604;_&#1571;&#1605;&#1585;(&#1575;&#1603;&#1578;&#1576;) , &#1605;&#1601;&#1593;&#1608;&#1604;_&#1576;&#1607;(&#1575;&#1587;&#1605;(&#1575;&#1604;&#1583;&#1585;&#1587;&#1614;)))), &#1581;&#1585;&#1601;_&#1593;&#1591;&#1601;(&#1579;&#1605;&#1617;&#1614;), &#1575;&#1604;&#1580;&#1605;&#1604;&#1577;&#1575;&#1604;&#1601;&#1593;&#1604;&#1610;&#1577;(&#1601;&#1593;&#1604;_&#1571;&#1605;&#1585;(&#1575;&#1604;&#1593;&#1576;))) // it's in arabic",
O = outputStream_file::create("arab.txt"),
O:write(S),
O:close().
Which program do you use for determining how "it looks in the file"?
Regards Thomas Linder Puls
PDC

Post Reply