Coder Social home page Coder Social logo

Comments (4)

Oleg-N-Cher avatar Oleg-N-Cher commented on September 1, 2024

b0dd134

from ofrontplus.

Oleg-N-Cher avatar Oleg-N-Cher commented on September 1, 2024

From: Josef Templ
Thu, 22 Jun 2017 16:36:17

Hi Oleg,

first of all I have added another fix in OpenReader:

IF pos > 0 THEN ... ELSIF pos < 0 THEN pos := 0 END;

Regarding the BOM, I am not sure if it gives sense in ofront because there is no UNICODE support at all.

In general, I am also not sure that the BOM support is best placed in OpenReader.
I guess (without having implemented it) that it is better placed in Open, where there is also the check for ascii.

  • Josef

from ofrontplus.

Oleg-N-Cher avatar Oleg-N-Cher commented on September 1, 2024

Dear Josef,

I fully agree with your proposal to check pos < 0 in OpenReader.

About checking BOM presence in OpenReader - of course, it could better placed in Open. That's what happens, if I do not know completely how these modules do work. I'm most often working with the code in parts.

I even do not use the Texts module in graphical mode (under ETH Oberon-like environment), where the UTF-8 encoding without additional support, could disrupt the overall logic of the view.

On the contrary, in the command-line mode, UTF-8 encoded strings can be entered by a user from the outside, for example, a file name from Args.Get. So the Args and Console modules already have support UTF-8 encoded strings, without any additional modifications. So we can say that we already have basic support of UTF-8, like:

Console.String("Текст на русском языке - Text in Russian language");

will be compiled and runned OK under Linux - if the line is UTF-8 encoded and the current locale is set to use the UTF-8 encoding.

UTF-8 characters are encoded by 1-4 bytes with value > 127 (any byte of a UTF-8 character is out of ASCII table). So Ofront can process such strings with multi-byte characters without any modifications (Ofront allows characters with > 127, and it does not matter that one character will occupy several bytes).

I actively use comments in Russian in my sources. And I do not want to use the encodings like Windows 1251 or KOI8-R (they are non-portable between Windows and Linux). And the encoding UTF-8 looks very tempting to use for comments in a national language. And thus there is an opportunity to edit such sources in Windows Notepad (with BOM), pico, vim or gedit (with BOM too, they even support 0DX+0AX as end-of-line!).

It is for that I propose to support checking the BOM by the code:

81c06ec

And I'll happily listen to your comments. I implemented only reading. At the moment, this is enough for me. In future, we could save the BOM flag to correctly overwrite existing files that already have it.

from ofrontplus.

Oleg-N-Cher avatar Oleg-N-Cher commented on September 1, 2024

0703e02

from ofrontplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.