Fix assertion for string emptiness check

Fix encoding method at test. + Fix string check for non empty value.