Repository: gofiber/fiber (Go)

Issue:
🚀 [Feature]: filesystem.Config add file encoding property support
### Feature Description

now use filesystem like this、the response header content-type of the file has no charset、hope add property in filesystem.Config for response header content-type charset
<img width="502" alt="image" src="https://user-images.githubusercontent.com/24662536/234518454-bc593f97-cba5-49f0-a5d1-d74cdff0137e.png">


### Additional Context (optional)

_No response_

### Code Snippet (optional)

```go
package main

import "github.com/gofiber/fiber/v2"
import "github.com/gofiber/fiber/v2/middleware/filesystem"
import "log"
//go:embed resource/*
var FS embed.FS
func main() {
app.Use("/", filesystem.New(filesystem.Config{
		Root:       http.FS(FS),
		PathPrefix: "resource",
		Browse:     true,
                 ContentTypeCharset: "utf-8",
	}))
}
```


### Checklist:

- [X] I agree to follow Fiber's [Code of Conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md).
- [X] I have checked for existing issues that describe my suggestion prior to opening this one.
- [X] I understand that improperly formatted feature requests may be closed without explanation.


Discussion:
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord




Patch:
diff --git a/docs/api/middleware/filesystem.md b/docs/api/middleware/filesystem.md
index a3029f96f1..9bc3864cda 100644
--- a/docs/api/middleware/filesystem.md
+++ b/docs/api/middleware/filesystem.md
@@ -249,13 +249,13 @@ type Config struct {
     // Required. Default: nil
     Root http.FileSystem `json:"-"`
 
-	// PathPrefix defines a prefix to be added to a filepath when
-	// reading a file from the FileSystem.
-	//
-	// Use when using Go 1.16 embed.FS
-	//
-	// Optional. Default ""
-	PathPrefix string `json:"path_prefix"`
+    // PathPrefix defines a prefix to be added to a filepath when
+    // reading a file from the FileSystem.
+    //
+    // Use when using Go 1.16 embed.FS
+    //
+    // Optional. Default ""
+    PathPrefix string `json:"path_prefix"`
 
     // Enable directory browsing.
     //
@@ -277,6 +277,12 @@ type Config struct {
     //
     // Optional. Default: ""
     NotFoundFile string `json:"not_found_file"`
+    
+    // The value for the Content-Type HTTP-header
+    // that is set on the file response
+    //
+    // Optional. Default: ""
+    ContentTypeCharset string `json:"content_type_charset"`
 }
 ```
 
@@ -286,9 +292,10 @@ type Config struct {
 var ConfigDefault = Config{
     Next:   nil,
     Root:   nil,
-	PathPrefix: "",
+    PathPrefix: "",
     Browse: false,
     Index:  "/index.html",
     MaxAge: 0,
+    ContentTypeCharset: "",
 }
 ```
diff --git a/middleware/filesystem/filesystem.go b/middleware/filesystem/filesystem.go
index 02169d57c9..4b5b6c2928 100644
--- a/middleware/filesystem/filesystem.go
+++ b/middleware/filesystem/filesystem.go
@@ -53,16 +53,23 @@ type Config struct {
 	//
 	// Optional. Default: ""
 	NotFoundFile string `json:"not_found_file"`
+
+	// The value for the Content-Type HTTP-header
+	// that is set on the file response
+	//
+	// Optional. Default: ""
+	ContentTypeCharset string `json:"content_type_charset"`
 }
 
 // ConfigDefault is the default config
 var ConfigDefault = Config{
-	Next:       nil,
-	Root:       nil,
-	PathPrefix: "",
-	Browse:     false,
-	Index:      "/index.html",
-	MaxAge:     0,
+	Next:               nil,
+	Root:               nil,
+	PathPrefix:         "",
+	Browse:             false,
+	Index:              "/index.html",
+	MaxAge:             0,
+	ContentTypeCharset: "",
 }
 
 // New creates a new middleware handler.
@@ -176,7 +183,11 @@ func New(config ...Config) fiber.Handler {
 		contentLength := int(stat.Size())
 
 		// Set Content Type header
-		c.Type(getFileExtension(stat.Name()))
+		if cfg.ContentTypeCharset == "" {
+			c.Type(getFileExtension(stat.Name()))
+		} else {
+			c.Type(getFileExtension(stat.Name()), cfg.ContentTypeCharset)
+		}
 
 		// Set Last Modified header
 		if !modTime.IsZero() {


Test patch:
diff --git a/middleware/filesystem/filesystem_test.go b/middleware/filesystem/filesystem_test.go
index 56c113e0c5..d592046c45 100644
--- a/middleware/filesystem/filesystem_test.go
+++ b/middleware/filesystem/filesystem_test.go
@@ -218,3 +218,17 @@ func Test_FileSystem_UsingParam_NonFile(t *testing.T) {
 	utils.AssertEqual(t, nil, err)
 	utils.AssertEqual(t, 404, resp.StatusCode)
 }
+
+func Test_FileSystem_UsingContentTypeCharset(t *testing.T) {
+	t.Parallel()
+	app := fiber.New()
+	app.Use(New(Config{
+		Root:               http.Dir("../../.github/testdata/fs/index.html"),
+		ContentTypeCharset: "UTF-8",
+	}))
+
+	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", nil))
+	utils.AssertEqual(t, nil, err)
+	utils.AssertEqual(t, 200, resp.StatusCode)
+	utils.AssertEqual(t, "text/html; charset=UTF-8", resp.Header.Get("Content-Type"))
+}