Skip to content

Commit

Permalink
Remove CodePages reference; Update readme; Bump to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan5366x committed Sep 28, 2020
1 parent 106cd31 commit 5a9c670
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
9 changes: 3 additions & 6 deletions MagicFileEncoding/MagicFileEncoding.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageVersion>1.0.0-preview.3</PackageVersion>
<PackageVersion>1.0.0</PackageVersion>
<Title>Magic File Encoding</Title>
<Authors>Jan Schwien</Authors>
<Copyright>by Jan Schwien</Copyright>
<PackageProjectUrl>https://github.com/Jan5366x/MagicFileEncoding</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/Jan5366x/MagicFileEncoding/blob/master/LICENCE.txt</PackageLicenseUrl>
<RepositoryUrl>https://github.com/Jan5366x/MagicFileEncoding</RepositoryUrl>
<PackageReleaseNotes>Alpha Release</PackageReleaseNotes>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageTags>encoding, text</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
</ItemGroup>

</Project>
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@ Be aware of possible transformation issues if the target encoding is more simple

It is strongly recommended to write unit tests for your use case to ensure the load and transformation works as expected.

### Nuget Package
## Nuget Package
[MagicFileEncoding at nuget.org](https://www.nuget.org/packages/MagicFileEncoding/)

### Usage (Preview Version)
## Usage

#### Read a text file
```csharp
// read a text file
var mfe = new global::MagicFileEncoding.MagicFileEncoding();
var str = mfe.AutomaticReadAllText(filename);
new FileEncoding().AutomaticReadAllText(filename);
```
#### Write a text file
```csharp
// write a text file
var mfe = new global::MagicFileEncoding.MagicFileEncoding();
_mfe.WriteAllText(tmpFile.Path, text, Encoding.UTF8);
new FileEncoding().WriteAllText(tmpFile.Path, text, Encoding.UTF8);
```
### Fallback Encoding
#### Change fallback (default) encoding
```csharp
var fe = new cFileEncoding();
fe.FallbackEncoding = Encoding.Unicode;
var str = fe.AutomaticReadAllText(filename);
```
## Fallback Encoding
The fallback encoding is ISO-8859-1 (Latin-1) by default but can be changed via property.

(Because this lib was designed for the german culture space)

# Credits
## Credits
This work is heavily based on the following stack overflow articles:<br />
[effective-way-to-find-any-files-encoding](https://stackoverflow.com/questions/3825390/effective-way-to-find-any-files-encoding) <br />
[determine-a-strings-encoding-in-c-sharp](https://stackoverflow.com/questions/1025332/determine-a-strings-encoding-in-c-sharp) <br />
Expand Down
1 change: 0 additions & 1 deletion UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 5a9c670

Please sign in to comment.