Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add encoding setting #1203

Closed
wants to merge 34 commits into from
Closed

Conversation

luah5
Copy link
Member

@luah5 luah5 commented Mar 25, 2023

Description

This PR adds a preference for how files are to be encoded when read the options are:

  • ascii
  • iso2022JP
  • isoLatin1
  • isoLatin2
  • japaneseEUC
  • macOSRoman
  • nextstep
  • nonLossyASCII
  • shiftJIS
  • symbol
  • unicode
  • utf16
  • utf16BigEndian
  • utf16LittleEndian
  • utf32
  • utf32BigEndian
  • utf32LittleEndian
  • utf8

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code
  • Rename encoding -> decoding

Screenshots

shot

shot

shot 1

as you can see the file opens with UTF32 encoding but not in ascii

@luah5 luah5 changed the title Add encoding preference + minorly improve readability Add decoding preference + minorly improve readability Mar 25, 2023
@luah5 luah5 marked this pull request as draft March 25, 2023 15:39
@lukepistrol
Copy link
Member

Also the Code does not currently compile. Please always clean-build the app before pushing the changes.

luah5 and others added 10 commits March 25, 2023 17:30
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…gPreferences.swift

Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
@lukepistrol
Copy link
Member

lukepistrol commented Mar 25, 2023

@luah5 I just pushed a couple of my proposed changes which fixed some build errors and code duplication.

It now looks like this and works as expected selection-wise:

Screenshot 2023-03-25 at 19 07 39

@luah5 luah5 requested a review from lukepistrol March 25, 2023 18:09
@luah5 luah5 marked this pull request as ready for review March 25, 2023 21:06
@lukepistrol
Copy link
Member

Could you please add some screenshots of how different encodings look like when rendered? Especially when using characters only available in a specific encoding.

@lukepistrol
Copy link
Member

I'm pretty sure that ASCII would show something when decoding a UTF-32 string. Especially when most of the characters are also available in ASCII

@lukepistrol lukepistrol marked this pull request as draft April 7, 2023 15:05
@lukepistrol
Copy link
Member

Marked as blocking since the UI part needs to be re-implemented once #1215 is merged.

Also it does not work as expected yet (see this comment)

@luah5 luah5 changed the title Add decoding preference + minorly improve readability Add encoding preference Apr 30, 2023
@luah5 luah5 changed the title Add encoding preference Add encoding setting Apr 30, 2023
@luah5 luah5 marked this pull request as ready for review April 30, 2023 06:31
CodeEdit/Features/CodeFile/CodeFile.swift Outdated Show resolved Hide resolved
CodeEdit/Features/CodeFile/CodeFile.swift Outdated Show resolved Hide resolved
@luah5 luah5 requested a review from austincondiff May 1, 2023 05:23
@LostInCompilation
Copy link

Did I get it right that files which don't match the set encoding setting (in Settings pane) just open as a blank file? I would expect that displaying the file should at least be tried, rendering symbols not known in current encoding as for example question marks.
Just displaying an error about wrong encoding is also not the best I think. Since the positions then needs to fiddle around in the settings to set a matching encoding for the file to be opened.
Best would be that CodeEdit just selects the right encoding based on BOM or probability if it cannot be determined.

With the current release some files with unknown encoding just open up as empty (see #1263). If this PR gets implemented displaying a file as empty should not happen IMHO.

@luah5 luah5 closed this Jun 15, 2023
@luah5
Copy link
Member Author

luah5 commented Jun 15, 2023

Closed due to too many merge conflicts.

@luah5 luah5 deleted the encoding-preference branch December 15, 2023 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Text decoding setting
5 participants