docstr: Attempt to create field with a name not supported by the encoding
  
  ESRI Shapefile driver defaults to ISO-8859-1 encoding if none is
  specified. This doesn't support the field name used. Previously this
  went undetected and would raise a KeyError later when the user tried
  to write a feature to the layer. Instead we raise a more useful error.
  
  See GH#595.
docstr_tok: ["Attempt","to","create","field","with","a","name","not","supported","by","the","encoding","ESRI","Shapefile","driver","defaults","to","ISO-8859-1","encoding","if","none","is","specified",".","This","does","n't","support","the","field","name","used",".","Previously","this","went","undetected","and","would","raise","a","KeyError","later","when","the","user","tried","to","write","a","feature","to","the","layer",".","Instead","we","raise","a","more","useful","error",".","See","GH","#","595","."]
code: def test_gb2312_field_wrong_encoding(self):
      """Attempt to create field with a name not supported by the encoding
  
      ESRI Shapefile driver defaults to ISO-8859-1 encoding if none is
      specified. This doesn't support the field name used. Previously this
      went undetected and would raise a KeyError later when the user tried
      to write a feature to the layer. Instead we raise a more useful error.
  
      See GH#595.
      """
      field_name = "区县名称"
      meta = {
          "schema": {
              "properties": {field_name: "int"},
              "geometry": "Point",
          },
          "driver": "ESRI Shapefile",
      }
      feature = Feature.from_dict(
          **{
              "properties": {field_name: 123},
              "geometry": {"type": "Point", "coordinates": [1, 2]},
          }
      )
      # when encoding is specified, write is successful
      with fiona.open(
          os.path.join(self.tempdir, "test1.shp"),
          "w",
          encoding="GB2312",
          **meta,
      ) as collection:
          collection.write(feature)
      # no encoding
      with pytest.raises(SchemaError):
          fiona.open(
              os.path.join(self.tempdir, "test2.shp"), "w", **meta
          )
  
imports: import os
  import shutil
  import sys
  import tempfile
  import unittest
  import pytest
  import fiona
  from fiona.errors import SchemaError
  from fiona.model import Feature
label_desc: Use image node_id 6 for calling the TestUnicodeStringField obj's underlying member method code with example usage: obj.test_gb2312_field_wrong_encoding() without return types