Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11528 > unrolled thread
| Started by | JohnMartens <martens@tennishulp.info> |
|---|---|
| First post | 2018-04-05 07:19 +0200 |
| Last post | 2018-04-10 10:58 +0200 |
| Articles | 14 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-05 07:19 +0200
Re: Basis question for TXT file Mathias <mathias.hakansson@consultec.se> - 2018-04-05 01:22 -0700
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-05 14:25 +0200
Re: Basis question for TXT file Mathias <mathias.hakansson@consultec.se> - 2018-04-06 02:03 -0700
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-06 19:01 +0200
Re: Basis question for TXT file Sherlock <sherlock@sherlock.com.au> - 2018-04-08 00:23 -0700
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-08 19:52 +0200
Re: Basis question for TXT file "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-04-08 19:56 +0200
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-08 20:34 +0200
Re: Basis question for TXT file Sherlock <sherlock@sherlock.com.au> - 2018-04-08 16:24 -0700
Re: Basis question for TXT file Sherlock <sherlock@sherlock.com.au> - 2018-04-08 19:15 -0700
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-09 17:36 +0200
Re: Basis question for TXT file Sherlock <sherlock@sherlock.com.au> - 2018-04-10 01:42 -0700
Re: Basis question for TXT file JohnMartens <martens@tennishulp.info> - 2018-04-10 10:58 +0200
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-05 07:19 +0200 |
| Subject | Basis question for TXT file |
| Message-ID | <pa4bk2$og6$1@dont-email.me> |
I want to write basis output to a TXT file. What coding should I use so that é ë etc and ALT(180) linedraws are shown OK ? John
[toc] | [next] | [standalone]
| From | Mathias <mathias.hakansson@consultec.se> |
|---|---|
| Date | 2018-04-05 01:22 -0700 |
| Message-ID | <5ffd836d-fa54-416a-8f39-bd7daef385d9@googlegroups.com> |
| In reply to | #11528 |
That depends on what you are going to use your text file for. For viewing in windows in different languages? /Mathias Den torsdag 5 april 2018 kl. 07:19:00 UTC+2 skrev JohnMartens: > I want to write basis output to a TXT file. > > What coding should I use so that é ë etc and ALT(180) linedraws are > shown OK ? > > John
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-05 14:25 +0200 |
| Message-ID | <pa54k9$cj4$1@dont-email.me> |
| In reply to | #11529 |
Opening in Windows notepad and/or printing in Corrier font John Op 5-4-2018 om 10:22 schreef Mathias: > That depends on what you are going to use your text file for. For viewing in windows in different languages? > > /Mathias > > Den torsdag 5 april 2018 kl. 07:19:00 UTC+2 skrev JohnMartens: >> I want to write basis output to a TXT file. >> >> What coding should I use so that é ë etc and ALT(180) linedraws are >> shown OK ? >> >> John >
[toc] | [prev] | [next] | [standalone]
| From | Mathias <mathias.hakansson@consultec.se> |
|---|---|
| Date | 2018-04-06 02:03 -0700 |
| Message-ID | <3ab994de-f92a-41cc-b7b5-648e7be644c8@googlegroups.com> |
| In reply to | #11530 |
Then I would say that you don't need to to anything special. Just build a string and save it to a text file. procedure CreateTextFile(fileName as string,t as string) local f as ptr f := FCreate2(fileName,FC_NORMAL) FWrite(f,t) FClose(f) return If you need you textfile to be in UFT8 you can save it like this: CreateTextFils(sXMLFile,_chr(239) + _chr(187) + _chr(191) + Ansi2UTF8(sXML)) The three first characters signals that the file is UTF8 encoded. https://en.wikipedia.org/wiki/Byte_order_mark /MathiasH Den torsdag 5 april 2018 kl. 14:25:47 UTC+2 skrev JohnMartens: > Opening in Windows notepad and/or printing in Corrier font > > John > > Op 5-4-2018 om 10:22 schreef Mathias: > > That depends on what you are going to use your text file for. For viewing in windows in different languages? > > > > /Mathias > > > > Den torsdag 5 april 2018 kl. 07:19:00 UTC+2 skrev JohnMartens: > >> I want to write basis output to a TXT file. > >> > >> What coding should I use so that é ë etc and ALT(180) linedraws are > >> shown OK ? > >> > >> John > >
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-06 19:01 +0200 |
| Message-ID | <pa894g$vvn$1@dont-email.me> |
| In reply to | #11531 |
Thanks That works fine for é etc but not for linedrwa like CHR(179) Any clue how to solve that ? John Op 6-4-2018 om 11:03 schreef Mathias: > Then I would say that you don't need to to anything special. Just build a string and save it to a text file. > > procedure CreateTextFile(fileName as string,t as string) > local f as ptr > > f := FCreate2(fileName,FC_NORMAL) > FWrite(f,t) > FClose(f) > > return > > > If you need you textfile to be in UFT8 you can save it like this: > CreateTextFils(sXMLFile,_chr(239) + _chr(187) + _chr(191) + Ansi2UTF8(sXML)) > > The three first characters signals that the file is UTF8 encoded. > > https://en.wikipedia.org/wiki/Byte_order_mark > > /MathiasH > > Den torsdag 5 april 2018 kl. 14:25:47 UTC+2 skrev JohnMartens: >> Opening in Windows notepad and/or printing in Corrier font >> >> John >> >> Op 5-4-2018 om 10:22 schreef Mathias: >>> That depends on what you are going to use your text file for. For viewing in windows in different languages? >>> >>> /Mathias >>> >>> Den torsdag 5 april 2018 kl. 07:19:00 UTC+2 skrev JohnMartens: >>>> I want to write basis output to a TXT file. >>>> >>>> What coding should I use so that é ë etc and ALT(180) linedraws are >>>> shown OK ? >>>> >>>> John >>> >
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2018-04-08 00:23 -0700 |
| Message-ID | <39967eb6-f3a1-441a-a939-e2ae4a0b94e8@googlegroups.com> |
| In reply to | #11528 |
John snip[ I want to write basis output to a TXT file. ] snip[ What coding should I use so that é ë etc and ALT(180) linedraws.. ] //MemoWrit(<cFileName>, <cString>) ---> lSuccess cMyTextData := "blah..blah + _CHR(180) // any CHR MemoWrit( "c:\temp\mytextdata.txt", cMyTextData ) Phil
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-08 19:52 +0200 |
| Message-ID | <111aedec-edb6-2fc4-675a-adc2908af4d1@tennishulp.info> |
| In reply to | #11535 |
If I do that and I open the file in windows Notepad the linedrwaw chars ar not showed in het right way _CHR(180) and CHR(180) do not make any difference in that case The UTF8 encode shows é in the right way where MemoWrit does not ... John There should be some setting Op 8-4-2018 om 09:23 schreef Sherlock: > John > > snip[ I want to write basis output to a TXT file. ] > snip[ What coding should I use so that é ë etc and ALT(180) linedraws.. ] > > //MemoWrit(<cFileName>, <cString>) ---> lSuccess > > cMyTextData := "blah..blah + _CHR(180) // any CHR > > MemoWrit( "c:\temp\mytextdata.txt", cMyTextData ) > > Phil >
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2018-04-08 19:56 +0200 |
| Message-ID | <fiv3fcFpog7U1@mid.individual.net> |
| In reply to | #11536 |
Hi John, if you want to see the linedraw characters you need the MS LineDraw font. Other fonts does not included the needed characters. Wolfgang JohnMartens wrote: > If I do that and I open the file in windows Notepad the linedrwaw > chars ar not showed in het right way _CHR(180) and CHR(180) do not > make any difference in that case > > The UTF8 encode shows é in the right way where MemoWrit does not ... > > John > > There should be some setting > > Op 8-4-2018 om 09:23 schreef Sherlock: > > John > > > > snip[ I want to write basis output to a TXT file. ] > > snip[ What coding should I use so that é ë etc and ALT(180) > > linedraws.. ] > > > >//MemoWrit(<cFileName>, <cString>) ---> lSuccess > > > > cMyTextData := "blah..blah + _CHR(180) // any CHR > > > > MemoWrit( "c:\temp\mytextdata.txt", cMyTextData ) > > > > Phil > > --
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-08 20:34 +0200 |
| Message-ID | <padnav$2b6$1@dont-email.me> |
| In reply to | #11537 |
You are right !!! Thanks Op 8-4-2018 om 19:56 schreef Wolfgang Riedmann: > Hi John, > > if you want to see the linedraw characters you need the MS LineDraw > font. > > Other fonts does not included the needed characters. > > Wolfgang > > JohnMartens wrote: > >> If I do that and I open the file in windows Notepad the linedrwaw >> chars ar not showed in het right way _CHR(180) and CHR(180) do not >> make any difference in that case >> >> The UTF8 encode shows é in the right way where MemoWrit does not ... >> >> John >> >> There should be some setting >> >> Op 8-4-2018 om 09:23 schreef Sherlock: >>> John >>> >>> snip[ I want to write basis output to a TXT file. ] >>> snip[ What coding should I use so that é ë etc and ALT(180) >>> linedraws.. ] >>> >>> //MemoWrit(<cFileName>, <cString>) ---> lSuccess >>> >>> cMyTextData := "blah..blah + _CHR(180) // any CHR >>> >>> MemoWrit( "c:\temp\mytextdata.txt", cMyTextData ) >>> >>> Phil >>> > > >
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2018-04-08 16:24 -0700 |
| Message-ID | <c21eff29-d537-450b-8821-292a30436cc9@googlegroups.com> |
| In reply to | #11528 |
John // FUNCTION Ansi2UTF8(cString AS STRING) AS STRING // RETURN ConvertFromCodePageToCodePage(cString, CP_ACP, CP_UTF8) // FUNCTION Utf82Ansi(cString AS STRING) AS STRING // RETURN ConvertFromCodePageToCodePage(cString, CP_UTF8, CP_ACP) LOCAL cData := "the quick " +CHR(180), cDataANSI, cUTF8Data AS STRING MemoWrit( GetDefault()+"textANSI.txt", cData) // cUTF8Data := Ansi2UTF8( cData ) cDataANSI := Utf82Ansi(cUTF8Data) // MemoWrit( GetDefault()+"textUTF8.txt", cDataANSI) cDataANSI := MemoRead( GetDefault()+"textUTF8.txt") // Read back after writing with MEMOWRIT and reading back // IF cData == cDataANSI ? "it worked.. yeah" ELSE ? "did not work" ENDIF _Wait() Phil
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2018-04-08 19:15 -0700 |
| Message-ID | <4dd23d9b-7f11-4196-bd8e-bb84b871384f@googlegroups.com> |
| In reply to | #11539 |
Correction... // FUNCTION Ansi2UTF8(cString AS STRING) AS STRING // RETURN ConvertFromCodePageToCodePage(cString, CP_ACP, CP_UTF8) // FUNCTION Utf82Ansi(cString AS STRING) AS STRING // RETURN ConvertFromCodePageToCodePage(cString, CP_UTF8, CP_ACP) LOCAL cData := "the quick " +CHR(180), cUTF8Data AS STRING LOCAL ptrFILE AS PTR ptrFILE := FCreate2(GetDefault()+"textUTF8.txt",FC_NORMAL) FWrite(ptrFILE, Ansi2UTF8( cData )) // Save as UTF8 FClose(ptrFILE) // ptrFILE := FOpen(GetDefault()+"textUTF8.txt", FO_READ) cUTF8Data := FReadLine( ptrFILE ) // Read UTF8 FClose(ptrFILE) // IF cData == Utf82Ansi(cUTF8Data) ? "it worked.. yeah" ELSE ? "did not work" ENDIF _Wait()
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-09 17:36 +0200 |
| Message-ID | <pag18q$jsq$1@dont-email.me> |
| In reply to | #11540 |
Hi Phil, This does the same as Mathias said using CreateTextFils(sXMLFile,_chr(239) + _chr(187) + _chr(191) + Ansi2UTF8(sXML)) I will make a "switch" in my app to built the .TXT output using LineDraw chars or a less nice |+- variant. Printing the UTF8 output using MS LineDraw font John Op 9-4-2018 om 04:15 schreef Sherlock: > Correction... > > // FUNCTION Ansi2UTF8(cString AS STRING) AS STRING > // RETURN ConvertFromCodePageToCodePage(cString, CP_ACP, CP_UTF8) > > // FUNCTION Utf82Ansi(cString AS STRING) AS STRING > // RETURN ConvertFromCodePageToCodePage(cString, CP_UTF8, CP_ACP) > > LOCAL cData := "the quick " +CHR(180), cUTF8Data AS STRING > LOCAL ptrFILE AS PTR > > ptrFILE := FCreate2(GetDefault()+"textUTF8.txt",FC_NORMAL) > FWrite(ptrFILE, Ansi2UTF8( cData )) // Save as UTF8 > FClose(ptrFILE) > // > ptrFILE := FOpen(GetDefault()+"textUTF8.txt", FO_READ) > cUTF8Data := FReadLine( ptrFILE ) // Read UTF8 > FClose(ptrFILE) > // > IF cData == Utf82Ansi(cUTF8Data) > ? "it worked.. yeah" > ELSE > ? "did not work" > ENDIF > _Wait() >
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2018-04-10 01:42 -0700 |
| Message-ID | <ab5a1492-8180-4d9f-a5c5-344772a2236c@googlegroups.com> |
| In reply to | #11542 |
John but where does CreateTextFils() come from ? What is behind this function. Could be / probably low level Frwrite or even Memowrit() Like to give samples where you can cut and paste that code and it works and part of standard VO Often in this group you can search old posts and samples.. great resource. Then you get code that calls something that is not posted. Phil
[toc] | [prev] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2018-04-10 10:58 +0200 |
| Message-ID | <pahuak$alr$1@dont-email.me> |
| In reply to | #11543 |
Sorry forgot to copy that part from Mathias his post John procedure CreateTextFile(fileName as string,t as string) local f as ptr f := FCreate2(fileName,FC_NORMAL) FWrite(f,t) FClose(f) return Op 10-4-2018 om 10:42 schreef Sherlock: > John > > but where does CreateTextFils() come from ? > What is behind this function. > Could be / probably low level Frwrite or even Memowrit() > > Like to give samples where you can cut and paste that code and it works and part of standard VO > > Often in this group you can search old posts and samples.. great resource. > Then you get code that calls something that is not posted. > > Phil >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web