Text and Source Code Import

Declare the language and encoding of a source file. Register the exercise scripts and find them in the Script Library.

acq.text_document · Version 1.2.0

For letture.txt choose Destination dataset, Import as text_document, language and encoding auto. In Preview, check how the characters are read and the type. After Import, look for document.text. The same tab accepts typed sources and UML documents. The chooser filters help you find UML, Python, Tcl, text/markup, and other sources, or all files. Detection and overrides decide the actual route.

Register a Script without running it

  1. For calcolo.py choose dataset if you want a Dataset that can be opened in Code. Use auto or session_script to register Python code as a Session Script if it is recognized.
  2. For calcolo.m declare the destination explicitly. With session_script and language octave, look for the corresponding entry in the Script Library. A .m file is ambiguous if you leave the destination on automatic.
  3. Check the ID, revision, and source in the library. Import completes this exercise. You can read the registered source without running it.

Declare language and encoding

Language (detection override) lets you use autodetection or select a specific language. An explicit choice is useful when extension and content are ambiguous, as with .m. Text and markup languages guide classification and reading. Python and Octave can lead to the Script Library if the destination supports them. A language override does not convert source code to another language.

Encoding auto uses source information such as a BOM or Python encoding declaration, and uses UTF-8 as the usual path. For testo-cp1252.txt, set cp1252 and check the euro symbol. For testo-utf16.txt, verify the BOM. The Dataset preserves source bytes, while Script registration requires UTF-8 source and may strip the BOM. If Preview reads the file but Code cannot open it correctly, retain the original and try a UTF-8 copy, checking the characters after conversion.

Find the exercise scripts

Open Sessions → Jobs → Run registered script… to open Script Library. Filter Scope to session if you want to see only the Session scripts. Select text_script_python or text_script_octave in the list and check the language, version, and revision in the window. Do not click Run to check the registration.

Code Dataset Viewer in P011-bis shows Canonical document is not valid UTF-8 with the Windows-1252 and UTF‑16 with BOM tests already published in Acquisition. Open a copy converted to UTF‑8 and published with a new ID. Reopen Code so that it reloads the list, choose Source Dataset and press Open source. In testo-copia-utf8.txt the € symbol remains readable.

Exercise files

Sources, licenses, and SHA-256

Screenshots

Open a screenshot to view it at full size.

letture.txt added in Acquisition with Dataset ID testo_quaderno. The row shows the import settings.
letture.txt added in Acquisition with Dataset ID testo_quaderno. The row shows the import settings.
Pending Preview of letture.txt with document and encoding properties.
Pending Preview of letture.txt with document and encoding properties.
After Import, the browser shows Active Dataset: testo_quaderno. The Metadata tab describes the recorded result.
After Import, the browser shows Active Dataset: testo_quaderno. The Metadata tab describes the recorded result.
CORE Dataset consultation opened for testo_quaderno, with the summary of the text resource.
CORE Dataset consultation opened for testo_quaderno, with the summary of the text resource.
Script Library with text_script_python selected and the Python revision in the Session.
Script Library with text_script_python selected and the Python revision in the Session.
Script Library with text_script_octave selected and the GNU Octave revision in the Session.
Script Library with text_script_octave selected and the GNU Octave revision in the Session.
Python source Dataset opened for consultation.
Python source Dataset opened for consultation.
Open source in Code leaves the editor empty. The message at the bottom says the canonical document is not valid UTF-8.
Open source in Code leaves the editor empty. The message at the bottom says the canonical document is not valid UTF-8.
The UTF-8 copy opened in Code displays the accented text.
The UTF-8 copy opened in Code displays the accented text.

Controls and settings

Scrollbar

Use the horizontal or vertical scrollbar to reach fields, entries, or text outside the visible area.

Default Dataset ID

Sets a proposed ID for the sources you add with this importer. Check the actual ID in each row before Import. The Dataset browser uses the published ID to find the result.

Default value in the basic configuration document.text.

Destination (Auto: Python Session script; .m requires explicit choice)

auto uses the classification and sends Python to the library when the type is supported. dataset publishes in the Dataset browser. session_script publishes a Script revision when language, encoding, and code are accepted.

Default value in the basic configuration auto.

  • auto · auto uses the classification and sends Python to the library when the type is supported. dataset publishes in the Dataset browser. session_script publishes a Script revision when language, encoding, and code are accepted.
  • dataset · auto uses the classification and sends Python to the library when the type is supported. dataset publishes in the Dataset browser. session_script publishes a Script revision when language, encoding, and code are accepted.
  • session_script · auto uses the classification and sends Python to the library when the type is supported. dataset publishes in the Dataset browser. session_script publishes a Script revision when language, encoding, and code are accepted.

Import as

auto detects the type, text_document forces the document destination if supported, and source_code asks for classification as code.

Default value in the basic configuration auto.

  • auto · auto detects the type, text_document forces the document destination if supported, and source_code asks for classification as code.
  • text_document · auto detects the type, text_document forces the document destination if supported, and source_code asks for classification as code.
  • source_code · auto detects the type, text_document forces the document destination if supported, and source_code asks for classification as code.

Language (detection override)

Choose auto for automatic resolution, or indicate the content language. The destination determines whether the language can lead to Script registration.

Default value in the basic configuration auto.

  • auto · Infers the language from type, extension, and content when supported.
  • plaintext · Declares plain text or an unknown language. Check the resulting type from Import as and Destination in the Dataset.
  • unknown · Declares plain text or an unknown language. Check the resulting type from Import as and Destination in the Dataset.
  • python · Declares Python. With Destination set to auto or session_script it registers a Session revision. With dataset it publishes the source.
  • tcl · Set tcl for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • octave · Declares GNU Octave intent. For a .m file, use Destination session_script to register it or dataset to consult the source.
  • matlab · Classifies the source explicitly. Use Destination dataset to keep it. Registration as a Session Script requires Python or GNU Octave to be declared.
  • matlab-octave · Classifies the source explicitly. Use Destination dataset to keep it. Registration as a Session Script requires Python or GNU Octave to be declared.
  • objective-c · Set objective-c for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • c · Set c for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • cpp · Set cpp for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • c-cpp · Set c-cpp for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • bash · Set bash for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • sh · Set sh for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • zsh · Set zsh for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • fish · Set fish for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • powershell · Set powershell for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • batch · Set batch for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • javascript · Set javascript for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • typescript · Set typescript for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • csharp · Set csharp for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • java · Set java for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • fortran · Set fortran for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • rust · Set rust for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • go · Set go for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • r · Set r for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • julia · Set julia for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • ruby · Set ruby for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • perl · Set perl for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • prolog · Set prolog for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • perl-prolog · Set perl-prolog for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • lua · Set lua for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • php · Set php for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • sql · Set sql for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • make · Set make for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • cmake · Set cmake for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • dockerfile · Set dockerfile for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • json · Set json for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • yaml · Set yaml for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • toml · Set toml for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • ini · Set ini for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • xml · Set xml for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • html · Set html for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • css · Set css for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • markdown · Set markdown for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • rst · Set rst for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • tex · Set tex for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.
  • gitignore · Set gitignore for a source of this type. Check the classification and how it opens. The override keeps the content and sets the available interpretation.

Encoding (auto = BOM / Python cookie / UTF-8)

If you know the charset, declare it to decode the text. auto uses the BOM, the Python encoding cookie, or UTF‑8, depending on the file. Preview lets you check the characters.

Default value in the basic configuration auto.

  • auto · Use auto only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-8 · Use utf-8 only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-8-sig · Use utf-8-sig only if it matches the input bytes. Check non-ASCII characters in Preview.
  • ascii · Use ascii only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-16 · Use utf-16 only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-16-le · Use utf-16-le only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-16-be · Use utf-16-be only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-32 · Use utf-32 only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-32-le · Use utf-32-le only if it matches the input bytes. Check non-ASCII characters in Preview.
  • utf-32-be · Use utf-32-be only if it matches the input bytes. Check non-ASCII characters in Preview.
  • cp1252 · Use cp1252 only if it matches the input bytes. Check non-ASCII characters in Preview.
  • iso-8859-1 · Use iso-8859-1 only if it matches the input bytes. Check non-ASCII characters in Preview.

Scrollbar

Use the horizontal or vertical scrollbar to reach fields, entries, or text outside the visible area.