How to set the value of a MeshPolygonStringProperty to a string?
Use the bmesh API
Suggest using bmesh for polygon string layers.
import bpy
import bmesh   

context = bpy.context
ob = context.object
me = ob.data

bm = bmesh.new()
bm.from_mesh(me)
str_layer = bm.faces.layers.string.new(&quot;Foo&quot;)

for f in bm.faces:
    f[str_layer] = bytes(f'Face {f.index}', 'utf-8')  # b`foo`
    
bm.to_mesh(me)
bm.clear()

for s in me.polygon_layers_string:
    print(f&quot; Layer {s.name}&quot;)
    for p in s.data:
        print(p.value.decode())